Sha256: 56e8fd30134e9ee1f45998304277f9c0d09fd15f382665c5318bf3601692f7cc
Contents?: true
Size: 874 Bytes
Versions: 21
Compression:
Stored size: 874 Bytes
Contents
class Code class Node class Dictionnary < Node class KeyValue < Node def initialize(parsed) if parsed.key?(:statement) @key = Node::Statement.new(parsed.delete(:statement)) elsif parsed.key?(:name) @key = Node::String.new([{ text: parsed.delete(:name) }]) end @value = Node::Code.new(parsed.delete(:value)) end def evaluate(**args) [@key.evaluate(**args), @value.evaluate(**args)] end end def initialize(parsed) parsed = [] if parsed == "" @key_values = parsed.map { |key_value| Node::Dictionnary::KeyValue.new(key_value) } end def evaluate(**args) ::Code::Object::Dictionnary.new( @key_values.map { |key_value| key_value.evaluate(**args) }.to_h ) end end end end
Version data entries
21 entries across 21 versions & 3 rubygems