Module: Pipetree::Flow::Operators
- Included in:
- Pipetree::Flow
- Defined in:
- lib/pipetree/flow.rb
Instance Method Summary collapse
- #%(proc, options = {}) ⇒ Object
-
#&(proc, options = {}) ⇒ Object
OnRight-> ? Right, input : Left, input.
-
#<(proc, options = {}) ⇒ Object
Optimize the most common steps with Stay/And objects that are faster than procs.
-
#>(proc, options = {}) ⇒ Object
TODO: test me.
- #>>(proc, options = {}) ⇒ Object
-
#_insert(step, options, original_proc, operator) ⇒ Object
:private: proc is the original step proc, e.g.
-
#index(proc) ⇒ Object
:private:.
Instance Method Details
#%(proc, options = {}) ⇒ Object
29 30 31 32 |
# File 'lib/pipetree/flow.rb', line 29 def %(proc, ={}) # no condition is needed, and we want to stay on the same track, too. _insert Stay.new(proc), , proc, "%" end |
#&(proc, options = {}) ⇒ Object
OnRight-> ? Right, input : Left, input
15 16 17 |
# File 'lib/pipetree/flow.rb', line 15 def &(proc, ={}) _insert On.new(Right, And.new(proc)), , proc, "&" end |
#<(proc, options = {}) ⇒ Object
Optimize the most common steps with Stay/And objects that are faster than procs.
10 11 12 |
# File 'lib/pipetree/flow.rb', line 10 def <(proc, ={}) _insert On.new(Left, Stay.new(proc)), , proc, "<" end |
#>(proc, options = {}) ⇒ Object
TODO: test me.
20 21 22 |
# File 'lib/pipetree/flow.rb', line 20 def >(proc, ={}) _insert On.new(Right, Stay.new(proc)), , proc, ">" end |
#>>(proc, options = {}) ⇒ Object
24 25 26 27 |
# File 'lib/pipetree/flow.rb', line 24 def >>(proc, ={}) _insert On.new(Right, ->(last, input, ) { [Right, proc.(input, )] } ), , proc, ">>" end |
#_insert(step, options, original_proc, operator) ⇒ Object
:private: proc is the original step proc, e.g. Validate.
36 37 38 39 40 41 42 43 |
# File 'lib/pipetree/flow.rb', line 36 def _insert(step, , original_proc, operator) = { append: true }.merge() insert!(step, ).tap do @step2proc ||= StepMap.new @step2proc[step] = [:name], original_proc, operator end end |
#index(proc) ⇒ Object
:private:
46 47 48 |
# File 'lib/pipetree/flow.rb', line 46 def index(proc) # @step2proc: { <On @proc> => {proc: @proc, name: "trb.validate", operator: "&"} } on = @step2proc.find_proc(proc) and return super(on) end |