Skip to content

Instantly share code, notes, and snippets.

@scudelletti
Created July 11, 2014 16:57
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 scudelletti/d74a85cdd7b39a735ff6 to your computer and use it in GitHub Desktop.
Save scudelletti/d74a85cdd7b39a735ff6 to your computer and use it in GitHub Desktop.
Precedence between ruby blocks
def first_function(something, &block)
puts "First - Do I have a Block? #{block_given?}"
end
def second_function(&block)
puts "Second - Do I have a Block? #{block_given?}"
end
puts "USING: {}"
first_function second_function { 'YEAP' }
puts
puts "USING: do/end"
first_function second_function do 'YEAP' end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment