Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ruby block has a different priority when using "do..end" or "{}"
def test1(params)
p "test1 #{params}"
end
def test2(&block)
if block_given?
p "test2 with block"
yield
else
p "test2 without block"
end
"test2"
end
test1 data: test2 do
p "block with 'do..end'"
end
test1 data: test2 {
p "block with '{}'"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment