Class: AbstractMapper::PairRule Abstract
- Defined in:
- lib/abstract_mapper/pair_rule.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::Node
readonly
The left node in the pair to be optimized.
-
#node ⇒ AbstractMapper::Node
readonly
The right node in the pair to be optimized.
-
#right ⇒ AbstractMapper::Node
readonly
The right node in the pair to be optimized.
Attributes inherited from Rule
Class Method Summary collapse
- .initialize(left, right) ⇒ Object
-
.new(node) ⇒ AbstractMapper::Rule
Creates a rule applied to the sole node.
Methods inherited from Rule
call, optimize, optimize?, transproc
Instance Attribute Details
#left ⇒ AbstractMapper::Node (readonly)
Returns The left node in the pair to be optimized.
39 40 41 |
# File 'lib/abstract_mapper/pair_rule.rb', line 39 def left @left end |
#node ⇒ AbstractMapper::Node (readonly)
Returns The right node in the pair to be optimized.
39 |
# File 'lib/abstract_mapper/pair_rule.rb', line 39 attr_reader :left |
#right ⇒ AbstractMapper::Node (readonly)
Returns The right node in the pair to be optimized.
45 46 47 |
# File 'lib/abstract_mapper/pair_rule.rb', line 45 def right @right end |
Class Method Details
.initialize(left, right) ⇒ Object
56 57 58 59 60 |
# File 'lib/abstract_mapper/pair_rule.rb', line 56 def initialize(left, right) @left = left @right = right super end |
.new(node) ⇒ AbstractMapper::Rule
Creates a rule applied to the sole node
|
# File 'lib/abstract_mapper/pair_rule.rb', line 47
|