Class: Dry::Transformer::Composite Private
- Inherits:
-
Object
- Object
- Dry::Transformer::Composite
- Defined in:
- lib/dry/transformer/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.
20 21 22 23 |
# File 'lib/dry/transformer/composite.rb', line 20 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.
12 13 14 |
# File 'lib/dry/transformer/composite.rb', line 12 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.
17 18 19 |
# File 'lib/dry/transformer/composite.rb', line 17 def right @right end |
Instance Method Details
#call(value) ⇒ Object Also known as: []
Call right side with the result from the left side
32 33 34 |
# File 'lib/dry/transformer/composite.rb', line 32 def call(value) right.call(left.call(value)) end |
#compose(other) ⇒ Object Also known as: +, >>
40 41 42 |
# File 'lib/dry/transformer/composite.rb', line 40 def compose(other) self.class.new(self, other) end |
#to_ast ⇒ Object
49 50 51 |
# File 'lib/dry/transformer/composite.rb', line 49 def to_ast left.to_ast << right.to_ast end |