Class: Method
Instance Method Summary collapse
-
#apply(*args) ⇒ Object
Curries this Method and partially applies parameters.
-
#curry(n = nil) ⇒ Object
rest of arguments.
-
#to_iter(*args) ⇒ Object
on this method’s receiver.
Instance Method Details
#apply(*args) ⇒ Object
Curries this Method and partially applies parameters. If a sufficient number of arguments are supplied, it passes the supplied arguments to the original proc and returns the result. Otherwise, returns another curried proc that takes the rest of arguments.
39 40 41 |
# File 'lib/mug/apply.rb', line 39 def apply(*args) curry.call(*args) end |
#curry(n = nil) ⇒ Object
rest of arguments.
24 25 26 27 28 29 30 |
# File 'lib/mug/apply.rb', line 24 def curry(n=nil) if n to_proc.curry n else to_proc.curry end end |