Class: Code::Node::Dictionnary
- Inherits:
-
Object
- Object
- Code::Node::Dictionnary
- Defined in:
- lib/code/node/dictionnary.rb
Instance Method Summary collapse
- #evaluate(context) ⇒ Object
-
#initialize(key_values) ⇒ Dictionnary
constructor
A new instance of Dictionnary.
Constructor Details
#initialize(key_values) ⇒ Dictionnary
Returns a new instance of Dictionnary.
4 5 6 7 8 9 |
# File 'lib/code/node/dictionnary.rb', line 4 def initialize(key_values) @key_values = key_values.map do |key_value| ::Code::Node::DictionnaryKeyValue.new(key_value) end end |
Instance Method Details
#evaluate(context) ⇒ Object
11 12 13 14 15 |
# File 'lib/code/node/dictionnary.rb', line 11 def evaluate(context) ::Code::Object::Dictionnary.new( @key_values.map { |key_value| key_value.evaluate(context) }.to_h ) end |