Created
October 15, 2014 12:43
-
-
Save mizutaki/d10ace0803ad2818aa5d to your computer and use it in GitHub Desktop.
instance_eval
This file contains 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
array = ['foo', 'bar'] | |
block = proc {first} | |
block2 = proc {last} | |
#block.call error undefined local variable or methods | |
array.instance_eval(&block) #foo | |
array.instance_eval(&block2) #bar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment