Class: Method
Instance Method Summary collapse
-
#apply(*args) ⇒ Object
Curries this Method and partially applies parameters.
-
#to_iter(*args) ⇒ Object
Creates a new Iterator for this method, initially invoked 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.
24 25 26 27 |
# File 'lib/mug/apply.rb', line 24 def apply(*args) n = arity < 0 ? -arity - 1 : arity curry(n).call(*args) end |