Module: Invokable::Compose
Overview
Instance Method Summary collapse
-
#<<(invokable) ⇒ Proc
Return a proc that is the composition of this invokable and the given invokable.
-
#>>(invokable) ⇒ Proc
Return a proc that is the composition of this invokable and the given invokable.
Instance Method Details
#<<(invokable) ⇒ Proc
Return a proc that is the composition of this invokable and the given invokable. The returned proc takes a variable number of arguments, calls invokable with them then calls this proc with the result.
14 15 16 17 18 |
# File 'lib/invokable/compose.rb', line 14 def <<(invokable) lambda do |*args| call(Invokable.coerce(invokable).call(*args)) end end |
#>>(invokable) ⇒ Proc
Return a proc that is the composition of this invokable and the given invokable. The returned proc takes a variable number of arguments, calls invokable with them then calls this proc with the result.
25 26 27 28 29 |
# File 'lib/invokable/compose.rb', line 25 def >>(invokable) lambda do |*args| Invokable.coerce(invokable).call(call(*args)) end end |