Class: Pacer::Wrappers::PathWrappingPipeFunction
- Inherits:
-
Object
- Object
- Pacer::Wrappers::PathWrappingPipeFunction
- Defined in:
- lib/pacer/wrappers/path_wrapping_pipe_function.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#graph ⇒ Object
readonly
Returns the value of attribute graph.
-
#wrapper ⇒ Object
readonly
Returns the value of attribute wrapper.
Instance Method Summary collapse
- #arity ⇒ Object
- #call_with_args(element, *args) ⇒ Object
- #compute(path) ⇒ Object (also: #call)
-
#initialize(back, block) ⇒ PathWrappingPipeFunction
constructor
A new instance of PathWrappingPipeFunction.
Constructor Details
#initialize(back, block) ⇒ PathWrappingPipeFunction
Returns a new instance of PathWrappingPipeFunction.
8 9 10 11 12 13 14 |
# File 'lib/pacer/wrappers/path_wrapping_pipe_function.rb', line 8 def initialize(back, block) @block = block if back @graph = back.graph end @wrapper = WrapperSelector.build graph end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
6 7 8 |
# File 'lib/pacer/wrappers/path_wrapping_pipe_function.rb', line 6 def block @block end |
#graph ⇒ Object (readonly)
Returns the value of attribute graph.
6 7 8 |
# File 'lib/pacer/wrappers/path_wrapping_pipe_function.rb', line 6 def graph @graph end |
#wrapper ⇒ Object (readonly)
Returns the value of attribute wrapper.
6 7 8 |
# File 'lib/pacer/wrappers/path_wrapping_pipe_function.rb', line 6 def wrapper @wrapper end |
Instance Method Details
#arity ⇒ Object
16 17 18 |
# File 'lib/pacer/wrappers/path_wrapping_pipe_function.rb', line 16 def arity block.arity end |
#call_with_args(element, *args) ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/pacer/wrappers/path_wrapping_pipe_function.rb', line 33 def call_with_args(element, *args) if path.first.is_a? Pacer::Wrappers::ElementWrapper block.call path, *args else p = path.map do |element| wrapper.new graph, element end block.call p, *args end end |
#compute(path) ⇒ Object Also known as: call
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/pacer/wrappers/path_wrapping_pipe_function.rb', line 20 def compute(path) if path.first.is_a? Pacer::Wrappers::ElementWrapper block.call path else p = path.map do |element| wrapper.new graph, element end block.call p end end |