Module: Datapipes::Composable
Instance Attribute Summary collapse
-
#accumulated ⇒ Object
Returns the value of attribute accumulated.
Instance Method Summary collapse
-
#+(op2) ⇒ Object
Source and Sink can’t composed as function composition.
Instance Attribute Details
#accumulated ⇒ Object
Returns the value of attribute accumulated.
3 4 5 |
# File 'lib/datapipes/composable.rb', line 3 def accumulated @accumulated end |
Instance Method Details
#+(op2) ⇒ Object
Source and Sink can’t composed as function composition. So accumulates composed objects internaly, then use them later.
7 8 9 10 11 12 13 14 |
# File 'lib/datapipes/composable.rb', line 7 def +(op2) op1 = self op1_acc = (op1.accumulated || [op1]) op2_acc = (op2.accumulated || [op2]) self.class.new.tap do |o| o.accumulated = op1_acc + op2_acc end end |