Class: AbstractMapper::Rule Abstract Private
- Inherits:
-
Object
- Object
- AbstractMapper::Rule
- Defined in:
- lib/abstract_mapper/rule.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.
Base class for nodes optimization rules
Instance Attribute Summary collapse
-
#nodes ⇒ Array<AbstractMapper::Node>
readonly
private
Either one or two nodes to be optimized.
Class Method Summary collapse
-
.call ⇒ Array<AbstractMapper::Node>
private
Returns the result of the rule applied to the initialized [#nodes].
- .initialize(*nodes) ⇒ Object private
-
.new(*nodes) ⇒ AbstractMapper::Rule
Creates the rule for a sole node, or a pair of consecutive nodes.
-
.transproc ⇒ Transproc::Function
private
The transformation function that applies the rule to the array of nodes.
Instance Attribute Details
#nodes ⇒ Array<AbstractMapper::Node> (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.
Returns Either one or two nodes to be optimized.
26 27 28 |
# File 'lib/abstract_mapper/rule.rb', line 26 def nodes @nodes end |
Class Method Details
.call ⇒ Array<AbstractMapper::Node>
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 the result of the rule applied to the initialized [#nodes]
46 47 48 |
# File 'lib/abstract_mapper/rule.rb', line 46 def call optimize? ? [optimize].flatten.compact : nodes end |
.initialize(*nodes) ⇒ Object
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.
37 38 39 40 |
# File 'lib/abstract_mapper/rule.rb', line 37 def initialize(*nodes) @nodes = nodes.freeze freeze end |
.new(*nodes) ⇒ AbstractMapper::Rule
Creates the rule for a sole node, or a pair of consecutive nodes
|
|
# File 'lib/abstract_mapper/rule.rb', line 28
|
.transproc ⇒ Transproc::Function
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.
The transformation function that applies the rule to the array of nodes
17 18 19 |
# File 'lib/abstract_mapper/rule.rb', line 17 def self.transproc Functions[composer, proc { |*nodes| new(*nodes).call }] end |