Class: Sexp2Ruby::Node::OpAsgn2

Inherits:
Base
  • Object
show all
Defined in:
lib/sexp2ruby/node/op_asgn2.rb

Constant Summary

Constants inherited from Base

Base::ASSIGN_NODES, Base::LF, Base::LINE_LENGTH

Instance Attribute Summary

Attributes inherited from Base

#processor

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Sexp2Ruby::Node::Base

Instance Method Details

#to_s(exp) ⇒ Object

[:lvar, :c], :var=, :“||”, [:lit, 20]


6
7
8
9
10
11
12
13
14
# File 'lib/sexp2ruby/node/op_asgn2.rb', line 6

def to_s(exp)
  lhs = process(exp.shift)
  index = exp.shift.to_s[0..-2]
  msg = exp.shift

  rhs = process(exp.shift)

  "#{lhs}.#{index} #{msg}= #{rhs}"
end