Class: AbstractMapper::Rules Private
- Inherits:
-
Object
- Object
- AbstractMapper::Rules
- Defined in:
- lib/abstract_mapper/rules.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.
Registry of DSL rules applicable to nodes of AST
Instance Attribute Summary collapse
-
#registry ⇒ Array<AbstractMapper::SoleRule>
readonly
private
List of rules applicable to AST.
Class Method Summary collapse
-
.<<(other) ⇒ Object
private
Returns the copy of current registry with the new rule added.
-
.[](nodes) ⇒ Array<AbstractMapper::Node>
private
Applies all the registered rules to the array of nodes.
- .initialize(registry = []) ⇒ Object private
-
.new(registry) ⇒ AbstractMapper::Rules
Creates a registry with array of rules.
Instance Attribute Details
#registry ⇒ Array<AbstractMapper::SoleRule> (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 list of rules applicable to AST.
15 16 17 |
# File 'lib/abstract_mapper/rules.rb', line 15 def registry @registry end |
Class Method Details
.<<(other) ⇒ 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.
Returns the copy of current registry with the new rule added
38 39 40 |
# File 'lib/abstract_mapper/rules.rb', line 38 def <<(other) self.class.new(registry + [other]) end |
.[](nodes) ⇒ 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.
Applies all the registered rules to the array of nodes
48 49 50 |
# File 'lib/abstract_mapper/rules.rb', line 48 def [](nodes) @transproc ? @transproc[nodes] : nodes end |
.initialize(registry = []) ⇒ 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.
26 27 28 29 30 |
# File 'lib/abstract_mapper/rules.rb', line 26 def initialize(registry = []) @registry = registry.dup.freeze @transproc = ordered.map(&:transproc).inject(:>>) freeze end |
.new(registry) ⇒ AbstractMapper::Rules
Creates a registry with array of rules
|
|
# File 'lib/abstract_mapper/rules.rb', line 17
|