Module: Functo::Compose
- Defined in:
- lib/functo/compose.rb
Instance Method Summary collapse
- #>(outer) ⇒ Object
- #>>(outer) ⇒ Object
- #[](*args) ⇒ Object
- #compose(outer, splat: false) ⇒ Object
- #slurp ⇒ Object
- #to_proc ⇒ Object
Instance Method Details
#>(outer) ⇒ Object
22 23 24 |
# File 'lib/functo/compose.rb', line 22 def >(outer) compose(outer, splat: false) end |
#>>(outer) ⇒ Object
26 27 28 |
# File 'lib/functo/compose.rb', line 26 def >>(outer) compose(outer, splat: true) end |
#[](*args) ⇒ Object
2 3 4 |
# File 'lib/functo/compose.rb', line 2 def [](*args) call(*args) end |
#compose(outer, splat: false) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/functo/compose.rb', line 10 def compose(outer, splat: false) inner = self Functo.wrap do |*args, &block| if splat outer.call(*inner.call(*args), &block) else outer.call(inner.call(*args), &block) end end end |
#slurp ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/functo/compose.rb', line 30 def slurp inner = self Functo.wrap do |arr| inner.call(*arr) end end |
#to_proc ⇒ Object
6 7 8 |
# File 'lib/functo/compose.rb', line 6 def to_proc public_method(:call).to_proc end |