Class: Reforge::Transformation::Tree::AggregateNode
- Inherits:
-
Object
- Object
- Reforge::Transformation::Tree::AggregateNode
show all
- Includes:
- Factories
- Defined in:
- lib/reforge/transformation/tree/aggregate_node.rb,
lib/reforge/transformation/tree/aggregate_node/factories.rb,
lib/reforge/transformation/tree/aggregate_node/hash_node.rb,
lib/reforge/transformation/tree/aggregate_node/array_node.rb
Defined Under Namespace
Modules: Factories
Classes: ArrayNode, HashNode
Constant Summary
Constants included
from Factories
Factories::IMPLEMENTATION_FACTORIES, Factories::IMPLEMENTATION_TYPES
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Factories
#implementation_from
Constructor Details
11
12
13
14
15
|
# File 'lib/reforge/transformation/tree/aggregate_node.rb', line 11
def initialize(key_type)
@path = []
@implementation = implementation_from(key_type)
@key_type = key_type
end
|
Instance Attribute Details
#implementation ⇒ Object
Returns the value of attribute implementation.
9
10
11
|
# File 'lib/reforge/transformation/tree/aggregate_node.rb', line 9
def implementation
@implementation
end
|
Instance Method Details
#[](key) ⇒ Object
30
31
32
33
34
|
# File 'lib/reforge/transformation/tree/aggregate_node.rb', line 30
def [](key)
validate_key!(key)
implementation.children[key]
end
|
#[]=(key, node) ⇒ Object
21
22
23
24
25
26
27
28
|
# File 'lib/reforge/transformation/tree/aggregate_node.rb', line 21
def []=(key, node)
validate_node!(node)
validate_key!(key)
validate_no_redefinition!(key)
implementation.children[key] = node
node.update_path(@path + [key])
end
|
#call(source) ⇒ Object
17
18
19
|
# File 'lib/reforge/transformation/tree/aggregate_node.rb', line 17
def call(source)
implementation.call(source)
end
|
#update_path(path) ⇒ Object
36
37
38
39
|
# File 'lib/reforge/transformation/tree/aggregate_node.rb', line 36
def update_path(path)
@path = path
implementation.update_path(path)
end
|