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
-
.composer ⇒ Symbol
Returns the name of transproc used to compose rules.
- .initialize(left, right) ⇒ Object
-
.new(node) ⇒ AbstractMapper::Rule
Creates a rule applied to the sole node.
Methods inherited from Rule
Instance Attribute Details
#left ⇒ AbstractMapper::Node (readonly)
Returns The left node in the pair to be optimized.
41 42 43 |
# File 'lib/abstract_mapper/pair_rule.rb', line 41 def left @left end |
#node ⇒ AbstractMapper::Node (readonly)
Returns The right node in the pair to be optimized.
41 |
# File 'lib/abstract_mapper/pair_rule.rb', line 41 attr_reader :left |
#right ⇒ AbstractMapper::Node (readonly)
Returns The right node in the pair to be optimized.
47 48 49 |
# File 'lib/abstract_mapper/pair_rule.rb', line 47 def right @right end |
Class Method Details
.composer ⇒ Symbol
Returns the name of transproc used to compose rules
33 34 35 |
# File 'lib/abstract_mapper/pair_rule.rb', line 33 def self.composer :compact end |
.initialize(left, right) ⇒ Object
58 59 60 61 62 |
# File 'lib/abstract_mapper/pair_rule.rb', line 58 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 49
|