Class: Pacer::Wrappers::PathUnwrappingPipeFunction
- Inherits:
-
Object
- Object
- Pacer::Wrappers::PathUnwrappingPipeFunction
- Defined in:
- lib/pacer/wrappers/path_wrapping_pipe_function.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
Instance Method Summary collapse
- #arity ⇒ Object
- #call_with_args(path, *args) ⇒ Object
- #compute(path) ⇒ Object (also: #call)
-
#initialize(block) ⇒ PathUnwrappingPipeFunction
constructor
A new instance of PathUnwrappingPipeFunction.
- #unwrap(p) ⇒ Object
Constructor Details
#initialize(block) ⇒ PathUnwrappingPipeFunction
Returns a new instance of PathUnwrappingPipeFunction.
50 51 52 |
# File 'lib/pacer/wrappers/path_wrapping_pipe_function.rb', line 50 def initialize(block) @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
48 49 50 |
# File 'lib/pacer/wrappers/path_wrapping_pipe_function.rb', line 48 def block @block end |
Instance Method Details
#arity ⇒ Object
54 55 56 |
# File 'lib/pacer/wrappers/path_wrapping_pipe_function.rb', line 54 def arity block.arity end |
#call_with_args(path, *args) ⇒ Object
64 65 66 |
# File 'lib/pacer/wrappers/path_wrapping_pipe_function.rb', line 64 def call_with_args(path, *args) unwrap block.call path, *args end |
#compute(path) ⇒ Object Also known as: call
58 59 60 |
# File 'lib/pacer/wrappers/path_wrapping_pipe_function.rb', line 58 def compute(path) unwrap block.call path end |
#unwrap(p) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/pacer/wrappers/path_wrapping_pipe_function.rb', line 68 def unwrap(p) if p.is_a? Array p.map do |e| if e.is_a? ElementWrapper e.element else e end end elsif p.is_a? ElementWrapper p.element else p end end |