Class: Rjq::AST::Assignment

Inherits:
Node
  • Object
show all
Defined in:
lib/rjq/ast.rb

Constant Summary collapse

DELETE =
Object.new.freeze
NO_OUTPUT =
Object.new.freeze

Instance Attribute Summary collapse

Attributes inherited from Node

#source_span

Instance Method Summary collapse

Methods inherited from Node

#assign_value, #invalid_path_message, #paths, #take, #with_source_span

Constructor Details

#initialize(left, op, right) ⇒ Assignment

Returns a new instance of Assignment.



990
991
992
993
994
# File 'lib/rjq/ast.rb', line 990

def initialize(left, op, right)
  @left = left
  @op = op
  @right = right
end

Instance Attribute Details

#leftObject (readonly)

Returns the value of attribute left.



988
989
990
# File 'lib/rjq/ast.rb', line 988

def left
  @left
end

#opObject (readonly)

Returns the value of attribute op.



988
989
990
# File 'lib/rjq/ast.rb', line 988

def op
  @op
end

#rightObject (readonly)

Returns the value of attribute right.



988
989
990
# File 'lib/rjq/ast.rb', line 988

def right
  @right
end

Instance Method Details

#eval(input, context) ⇒ Object



996
997
998
# File 'lib/rjq/ast.rb', line 996

def eval(input, context)
  @op == '=' ? assign(input, context) : update(input, context)
end