Class: Transproc::Function::Composite Private
- Inherits:
-
Transproc::Function
- Object
- Transproc::Function
- Transproc::Function::Composite
- Defined in:
- lib/transproc/function.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
- #right ⇒ Proc readonly private
Attributes inherited from Transproc::Function
Instance Method Summary collapse
-
#call(value) ⇒ Object
(also: #[])
Call right side with the result from the left side.
- #compose(other) ⇒ Object (also: #+, #>>)
-
#initialize(fn, options = {}) ⇒ Composite
constructor
private
A new instance of Composite.
- #to_ast ⇒ Object
Constructor Details
#initialize(fn, options = {}) ⇒ 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.
78 79 80 81 |
# File 'lib/transproc/function.rb', line 78 def initialize(fn, = {}) super @right = .fetch(:right) end |
Instance Attribute Details
#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.
75 76 77 |
# File 'lib/transproc/function.rb', line 75 def right @right end |
Instance Method Details
#call(value) ⇒ Object Also known as: []
Call right side with the result from the left side
90 91 92 |
# File 'lib/transproc/function.rb', line 90 def call(value) right[left[value]] end |
#compose(other) ⇒ Object Also known as: +, >>
98 99 100 |
# File 'lib/transproc/function.rb', line 98 def compose(other) Composite.new(self, right: other) end |
#to_ast ⇒ Object
107 108 109 |
# File 'lib/transproc/function.rb', line 107 def to_ast left.to_ast << right.to_ast end |