Skip to content

Instantly share code, notes, and snippets.

@slemiere
Created April 18, 2013 15:46
Show Gist options
  • Save slemiere/5413795 to your computer and use it in GitHub Desktop.
Save slemiere/5413795 to your computer and use it in GitHub Desktop.
yield vs block.call
define_method("hello_yield") { yield }
define_method("hello_block_call") { |&block| block.call}
hello_yield { puts "hello Yield"}
# LocalJumpError: no block given (yield)
hello_block_call { puts "Hello Block Call"}
# Hello Block Call
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment