Class: JSE::Ast::QuoteNode

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(value, env) ⇒ QuoteNode

Returns a new instance of QuoteNode.



162
163
164
165
# File 'lib/jse/ast/nodes.rb', line 162

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

Instance Method Details

#apply(_call_env) ⇒ Object



167
168
169
# File 'lib/jse/ast/nodes.rb', line 167

def apply(_call_env)
  @value
end

#to_jsonObject



171
172
173
174
175
176
177
# File 'lib/jse/ast/nodes.rb', line 171

def to_json
  if @value.respond_to?(:to_json)
    ["$quote", @value.to_json]
  else
    ["$quote", @value]
  end
end