Class: Pipetree::Flow::StepMap
- Inherits:
-
Object
- Object
- Pipetree::Flow::StepMap
- Defined in:
- lib/pipetree/flow/step_map.rb
Overview
Map original proc or its name to the wrapped On. This class is solely dedicated for inspect and insert operations, and not involved at run-time at all.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(step, name, original_proc, operator) ⇒ Object
- #find_proc(original_proc) ⇒ Object
-
#initialize ⇒ StepMap
constructor
A new instance of StepMap.
Constructor Details
#initialize ⇒ StepMap
Returns a new instance of StepMap.
5 6 7 |
# File 'lib/pipetree/flow/step_map.rb', line 5 def initialize @hash = {} end |
Instance Method Details
#[](key) ⇒ Object
13 14 15 |
# File 'lib/pipetree/flow/step_map.rb', line 13 def [](key) @hash[key] end |
#[]=(step, name, original_proc, operator) ⇒ Object
9 10 11 |
# File 'lib/pipetree/flow/step_map.rb', line 9 def []=(step, (name, original_proc, operator)) @hash[step] = Pipetree::Flow::Inspect::Proc.new(name, original_proc, operator) end |
#find_proc(original_proc) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/pipetree/flow/step_map.rb', line 17 def find_proc(original_proc) method = original_proc.is_a?(String) ? :name : :proc @hash.find do |step, inspect_proc| inspect_proc.send(method) == original_proc and return step end end |