Skip to content

Instantly share code, notes, and snippets.

@kiote
Created March 24, 2016 16:21
Show Gist options
  • Save kiote/c370a15a99f693c30c7f to your computer and use it in GitHub Desktop.
Save kiote/c370a15a99f693c30c7f to your computer and use it in GitHub Desktop.

Revisions

  1. kiote renamed this gist Mar 24, 2016. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. kiote created this gist Mar 24, 2016.
    18 changes: 18 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    irb(main):001:0> def a(b = {})
    irb(main):002:1> puts b[:one]
    irb(main):003:1> end
    => :a
    irb(main):004:0> a

    => nil
    irb(main):005:0> a(nil)
    NoMethodError: undefined method `[]' for nil:NilClass
    from (irb):2:in `a'
    from (irb):5
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.2/lib/rails/commands/console.rb:110:in `start'
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.2/lib/rails/commands/console.rb:9:in `start'
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.2/lib/rails/commands/commands_tasks.rb:68:in `console'
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.2/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.2/lib/rails/commands.rb:17:in `<top (required)>'
    from /app/bin/rails:26:in `require'
    from /app/bin/rails:26:in `<main>'