Class: ToSOperator

Inherits:
Object
  • Object
show all
Defined in:
lib/cauldron/operator/to_s_operator.rb

Instance Method Summary collapse

Constructor Details

#initialize(indexes) ⇒ ToSOperator

Returns a new instance of ToSOperator.



3
4
5
# File 'lib/cauldron/operator/to_s_operator.rb', line 3

def initialize(indexes)
  @indexes = indexes
end

Instance Method Details

#build(operators, scope) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/cauldron/operator/to_s_operator.rb', line 7

def build(operators, scope)
  [
    :call,
    [:vcall, 
      [:@ident, scope[@indexes[0]]]
    ],
    :".",
    [:@ident, "to_s"]
  ]  
end