Skip to content

Instantly share code, notes, and snippets.

@jmdeldin
Created July 12, 2012 17:27
Show Gist options
  • Save jmdeldin/0a4654d3f95dfa4d3dcc to your computer and use it in GitHub Desktop.
Save jmdeldin/0a4654d3f95dfa4d3dcc to your computer and use it in GitHub Desktop.
Blocks without subjects
def foo(subject, &blk)
p blk.call(subject)
end
# works
foo("blah") do |subj|
subj.upcase
end
# what I want to work
foo("blah") do
upcase
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment