Skip to content

Instantly share code, notes, and snippets.

@ericallam
Forked from ngauthier/foo.rb
Created November 21, 2011 19:34
Show Gist options
  • Save ericallam/1383654 to your computer and use it in GitHub Desktop.
Save ericallam/1383654 to your computer and use it in GitHub Desktop.
currying an instance method
class Foo
def foo(x, y)
"foo! #{x} and #{y}"
end
def bar
# my imaginary syntax for "create functional reference from method foo with argument bar.
&(:foo, 5)
end
end
# Foo.new.bar(10).call
# => "foo! 5 and 10"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment