Created
February 15, 2013 20:19
-
-
Save jdunck/4963232 to your computer and use it in GitHub Desktop.
ruby wat #2
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
| hotsoup:causes jdunck$ irb | |
| irb(main):001:0> def x() | |
| irb(main):002:1> return 1 | |
| irb(main):003:1> end | |
| => nil | |
| irb(main):004:0> h = {} | |
| => {} | |
| irb(main):005:0> h[:a] = x | |
| => 1 | |
| irb(main):006:0> h | |
| => {:a=>1} | |
| irb(main):007:0> h[:a] = method(:x) | |
| => #<Method: Object#x> | |
| irb(main):008:0> h[:a] | |
| => #<Method: Object#x> | |
| irb(main):009:0> h[:a].call | |
| => 1 | |
| irb(main):010:0> h[:a] | |
| irb(main):011:0> z = h[:a] | |
| => #<Method: Object#x> | |
| irb(main):012:0> z | |
| => #<Method: Object#x> | |
| irb(main):013:0> x | |
| => 1 | |
| irb(main):014:0> z | |
| => #<Method: Object#x> | |
| irb(main):015:0> z.call | |
| => 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The lack of output from line #18 is the only thing I don't follow.