Skip to content

Instantly share code, notes, and snippets.

@mizutaki
Created October 15, 2014 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mizutaki/d10ace0803ad2818aa5d to your computer and use it in GitHub Desktop.
Save mizutaki/d10ace0803ad2818aa5d to your computer and use it in GitHub Desktop.
instance_eval
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