Skip to content

Instantly share code, notes, and snippets.

@gtmax
Last active April 21, 2016 09:02
Show Gist options
  • Save gtmax/ee220a315d6860c2a18011fa152be68f to your computer and use it in GitHub Desktop.
Save gtmax/ee220a315d6860c2a18011fa152be68f to your computer and use it in GitHub Desktop.
Symbol Monkeypatch to allow passing params to &
class Symbol
# Allows to pass args to &:method_name like so:
# [1.234, 2.345, 3.456].map &:round.(2) => [1.23, 2.34, 3.45]
def call(*args)
proc do |receiver|
receiver.send(self, *args)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment