Class: Transproc::Composite Private
- Inherits:
-
Object
- Object
- Transproc::Composite
- Defined in:
- lib/transproc/composite.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Composition of two functions
Instance Attribute Summary collapse
- #left ⇒ Proc readonly private
- #right ⇒ Proc readonly private
Instance Method Summary collapse
-
#call(value) ⇒ Object
(also: #[])
Call right side with the result from the left side.
- #compose(other) ⇒ Object (also: #+, #>>)
-
#initialize(left, right) ⇒ Composite
constructor
private
A new instance of Composite.
- #to_ast ⇒ Object
Constructor Details
#initialize(left, right) ⇒ Composite
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Composite.
19 20 21 22 |
# File 'lib/transproc/composite.rb', line 19 def initialize(left, right) @left = left @right = right end |
Instance Attribute Details
#left ⇒ Proc (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 |
# File 'lib/transproc/composite.rb', line 11 def left @left end |
#right ⇒ Proc (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 |
# File 'lib/transproc/composite.rb', line 16 def right @right end |
Instance Method Details
#call(value) ⇒ Object Also known as: []
Call right side with the result from the left side
31 32 33 |
# File 'lib/transproc/composite.rb', line 31 def call(value) right.call(left.call(value)) end |
#compose(other) ⇒ Object Also known as: +, >>
39 40 41 |
# File 'lib/transproc/composite.rb', line 39 def compose(other) self.class.new(self, other) end |
#to_ast ⇒ Object
48 49 50 |
# File 'lib/transproc/composite.rb', line 48 def to_ast left.to_ast << right.to_ast end |