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.
52 53 54 55 56 57 58 59 |
# File 'lib/code/node/dictionary.rb', line 52 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
61 62 63 64 65 |
# File 'lib/code/node/dictionary.rb', line 61 def evaluate(**args) ::Code::Object::Dictionary.new( (@key_values || []).to_h { |key_value| key_value.evaluate(**args) } ) end |