Created
July 7, 2013 22:45
-
-
Save Jacke/5945261 to your computer and use it in GitHub Desktop.
Block as closure
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
| def method_with_block_as_closure(&block) | |
| another_method block | |
| end | |
| def another_method(variable) | |
| m2 &variable | |
| end | |
| def m2 | |
| x=25 | |
| yield x | |
| end | |
| method_with_block_as_closure {|i| print "I am happy block #{i}"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment