Skip to content

Instantly share code, notes, and snippets.

@paulbellamy
Created August 28, 2012 08:39
Show Gist options
  • Save paulbellamy/3496235 to your computer and use it in GitHub Desktop.
Save paulbellamy/3496235 to your computer and use it in GitHub Desktop.
Ruby LolWut!?
irb(main):001:0> nil.foobar
NoMethodError: undefined method `foobar' for nil:NilClass
from (irb):1:in `evaluate'
from org/jruby/RubyKernel.java:1083:in `eval'
from /opt/ruby/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:158:in `eval_input'
from /opt/ruby/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:271:in `signal_status'
from /opt/ruby/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:155:in `eval_input'
from org/jruby/RubyKernel.java:1410:in `loop'
from org/jruby/RubyKernel.java:1183:in `catch'
from /opt/ruby/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:154:in `eval_input'
from /opt/ruby/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:71:in `start'
from org/jruby/RubyKernel.java:1183:in `catch'
from /opt/ruby/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:70:in `start'
from /etc/rbenv/versions/jruby-1.6.7.2/bin/irb:13:in `(root)'
irb(main):002:0> def foobar
irb(main):003:1> "hi!"
irb(main):004:1> end
=> nil
irb(main):005:0> nil.foobar
=> "hi!"
irb(main):006:0> nil.class.ancestors
=> [NilClass, Object, Kernel]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment