Created
November 11, 2010 02:11
-
-
Save mhorbul/671871 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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