Skip to content

Instantly share code, notes, and snippets.

@goshacmd
Last active December 10, 2015 05:48
Show Gist options
  • Save goshacmd/4389621 to your computer and use it in GitHub Desktop.
Save goshacmd/4389621 to your computer and use it in GitHub Desktop.
`proc` instead of named block param
# Doing this
def a(&block)
block.call if block_given?
end
a { p 1 }
# is equivalent to doing this
def b
proc.call if block_given?
end
b { p 1 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment