Class: Highway::Compiler::Analyze::Tree::Values::Hash

Inherits:
Base
  • Object
show all
Defined in:
lib/highway/compiler/analyze/tree/values/hash.rb

Overview

This class represents a hash value in the semantic tree. It consists of an array of child values.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#select_segments, #select_variable_segments, #select_variable_segments_with_scope

Constructor Details

#initialize(children) ⇒ Hash

Initialize an instance.

Parameters:



23
24
25
# File 'lib/highway/compiler/analyze/tree/values/hash.rb', line 23

def initialize(children)
  @children = children
end

Instance Attribute Details

#childrenHash<String, Highway::Compiler::Analyze::Tree::Values::*> (readonly)

The array of child values.



30
31
32
# File 'lib/highway/compiler/analyze/tree/values/hash.rb', line 30

def children
  @children
end

Instance Method Details

#flatten_segmentsArray<Highway::Compiler::Analyze::Tree::Segments::*>

The flat array of all segments.



35
36
37
# File 'lib/highway/compiler/analyze/tree/values/hash.rb', line 35

def flatten_segments
  @children.values.flat_map(&:flatten_segments)
end