Skip to content

Instantly share code, notes, and snippets.

@mhorbul
Created November 11, 2010 02:11
Show Gist options
  • Save mhorbul/671871 to your computer and use it in GitHub Desktop.
Save mhorbul/671871 to your computer and use it in GitHub Desktop.
ruby-1.9.1-p378 > class A
ruby-1.9.1-p378 ?> def foo
ruby-1.9.1-p378 ?> yield
ruby-1.9.1-p378 ?> end
ruby-1.9.1-p378 ?> def zoo
ruby-1.9.1-p378 ?> puts "zoo"
ruby-1.9.1-p378 ?> end
ruby-1.9.1-p378 ?> end
=> nil
ruby-1.9.1-p378 > a = A.new
=> #<A:0x00000100b53630>
ruby-1.9.1-p378 > a.foo { |o| o.zoo }
NoMethodError: undefined method `zoo' for nil:NilClass
from (irb):14:in `block in irb_binding'
from (irb):7:in `foo'
from (irb):14
from /Users/mhorbul/.rvm/rubies/ruby-1.9.1-p378/bin/irb:17:in `<main>'
ruby-1.9.1-p378 >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment