Class: Reforge::Transformation::Tree::AggregateNode::HashNode
- Inherits:
-
Object
- Object
- Reforge::Transformation::Tree::AggregateNode::HashNode
- Defined in:
- lib/reforge/transformation/tree/aggregate_node/hash_node.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
Instance Method Summary collapse
- #call(source) ⇒ Object
-
#initialize ⇒ HashNode
constructor
A new instance of HashNode.
- #update_path(path) ⇒ Object
Constructor Details
#initialize ⇒ HashNode
Returns a new instance of HashNode.
10 11 12 |
# File 'lib/reforge/transformation/tree/aggregate_node/hash_node.rb', line 10 def initialize @children = {} end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
8 9 10 |
# File 'lib/reforge/transformation/tree/aggregate_node/hash_node.rb', line 8 def children @children end |
Instance Method Details
#call(source) ⇒ Object
14 15 16 |
# File 'lib/reforge/transformation/tree/aggregate_node/hash_node.rb', line 14 def call(source) children.transform_values { |child| child.call(source) } end |
#update_path(path) ⇒ Object
18 19 20 |
# File 'lib/reforge/transformation/tree/aggregate_node/hash_node.rb', line 18 def update_path(path) children.each { |key, child| child.update_path(path + [key]) } end |