Class: Code::Node::Dictionary
- Inherits:
-
Code::Node
- Object
- Code::Node
- Code::Node::Dictionary
- Defined in:
- lib/code/node/dictionary.rb
Defined Under Namespace
Classes: KeyValue
Instance Method Summary collapse
- #evaluate(**args) ⇒ Object
-
#initialize(parsed) ⇒ Dictionary
constructor
A new instance of Dictionary.
Methods inherited from Code::Node
Constructor Details
#initialize(parsed) ⇒ Dictionary
Returns a new instance of Dictionary.
33 34 35 36 37 38 39 40 |
# File 'lib/code/node/dictionary.rb', line 33 def initialize(parsed) return if parsed.blank? @key_values = parsed.presence || [] @key_values.map! do |key_value| Node::Dictionary::KeyValue.new(key_value) end end |
Instance Method Details
#evaluate(**args) ⇒ Object
42 43 44 45 46 |
# File 'lib/code/node/dictionary.rb', line 42 def evaluate(**args) ::Code::Object::Dictionary.new( (@key_values || []).to_h { |key_value| key_value.evaluate(**args) } ) end |