Class: Ptolemy::TOML::ArrayLiteral
- Inherits:
-
Treetop::Runtime::SyntaxNode
- Object
- Treetop::Runtime::SyntaxNode
- Ptolemy::TOML::ArrayLiteral
- Defined in:
- lib/ptolemy/nodes.rb
Overview
Represents a homogeneous array. Mixing of types is not allowed for elements of an array.
- 1, 2, 3, 4
- “Hello”, “World”
- [“Alpha”, “Beta”], [1, 2]
-
<– This is fine
Instance Method Summary collapse
-
#to_value ⇒ Array
Evaluate the array by mapping the individual elements of the array to their evaluated selves.
Instance Method Details
#to_value ⇒ Array
Evaluate the array by mapping the individual elements of the array to their evaluated selves.
110 111 112 113 114 115 116 117 118 |
# File 'lib/ptolemy/nodes.rb', line 110 def to_value result = list.elements.map do|elem| elem.item.to_value end unless last.empty? result << last.item.to_value end result end |