Class: AbstractMapper::Rules Private
- Inherits:
-
Object
- Object
- AbstractMapper::Rules
- Defined in:
- lib/abstract_mapper/rules.rb,
lib/abstract_mapper/rules/base.rb,
lib/abstract_mapper/rules/pair.rb,
lib/abstract_mapper/rules/sole.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
Defined Under Namespace
Instance Attribute Summary collapse
-
#registry ⇒ Array<AbstractMapper::Rules::Base>
readonly
private
The 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::AST::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::Rules::Base> (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 the list of rules applicable to AST.
20 21 22 |
# File 'lib/abstract_mapper/rules.rb', line 20 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
43 44 45 |
# File 'lib/abstract_mapper/rules.rb', line 43 def <<(other) self.class.new(registry + [other]) end |
.[](nodes) ⇒ Array<AbstractMapper::AST::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
53 54 55 |
# File 'lib/abstract_mapper/rules.rb', line 53 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.
31 32 33 34 35 |
# File 'lib/abstract_mapper/rules.rb', line 31 def initialize(registry = []) @registry = registry.dup @transproc = registry.map(&:transproc).inject(:>>) IceNine.deep_freeze(self) end |
.new(registry) ⇒ AbstractMapper::Rules
Creates a registry with array of rules
|
# File 'lib/abstract_mapper/rules.rb', line 22
|