Class: AbstractMapper::Rules::Pair Abstract
- Defined in:
- lib/abstract_mapper/rules/pair.rb
Overview
This class is abstract.
The base class for rules to be applied to pairs of nodes.
The subclass should implement two instance methods:
-
‘#optimize?` to check if the optimization should be applied to the nodes
-
‘#optimize` that should return the merged node
Instance Attribute Summary collapse
-
#left ⇒ AbstractMapper::AST::Node
readonly
The left node in the pair.
-
#node ⇒ AbstractMapper::AST::Node
readonly
The right node in the pair.
-
#right ⇒ AbstractMapper::AST::Node
readonly
The right node in the pair.
Attributes inherited from Base
Class Method Summary collapse
- .initialize(left, right) ⇒ Object
-
.new(node) ⇒ AbstractMapper::Rules::Base
Creates a rule applied to the sole node.
Methods inherited from Base
#call, #initialize, #optimize, #optimize?, transproc
Constructor Details
This class inherits a constructor from AbstractMapper::Rules::Base
Instance Attribute Details
#left ⇒ AbstractMapper::AST::Node (readonly)
Returns The left node in the pair.
41 42 43 |
# File 'lib/abstract_mapper/rules/pair.rb', line 41 def left @left end |
#node ⇒ AbstractMapper::AST::Node (readonly)
Returns The right node in the pair.
41 |
# File 'lib/abstract_mapper/rules/pair.rb', line 41 attr_reader :left |
#right ⇒ AbstractMapper::AST::Node (readonly)
Returns The right node in the pair.
47 48 49 |
# File 'lib/abstract_mapper/rules/pair.rb', line 47 def right @right end |
Class Method Details
.initialize(left, right) ⇒ Object
58 59 60 61 62 |
# File 'lib/abstract_mapper/rules/pair.rb', line 58 def initialize(left, right) @left = left @right = right super end |
.new(node) ⇒ AbstractMapper::Rules::Base
Creates a rule applied to the sole node
|
# File 'lib/abstract_mapper/rules/pair.rb', line 49
|