Class: JSE::Ast::ObjectNode

Inherits:
AstNode
  • Object
show all
Defined in:
lib/jse/ast/nodes.rb

Instance Attribute Summary

Attributes inherited from AstNode

#env

Instance Method Summary collapse

Constructor Details

#initialize(dict, env) ⇒ ObjectNode

Returns a new instance of ObjectNode.



83
84
85
86
# File 'lib/jse/ast/nodes.rb', line 83

def initialize(dict, env)
  super(env)
  @dict = dict
end

Instance Method Details

#apply(call_env) ⇒ Object



88
89
90
# File 'lib/jse/ast/nodes.rb', line 88

def apply(call_env)
  @dict.transform_values { |v| call_env.eval(v) }
end

#to_jsonObject



92
93
94
# File 'lib/jse/ast/nodes.rb', line 92

def to_json
  @dict.transform_values(&:to_json)
end