class SyntaxTree::YARV::ObjToString

### Summary

‘objtostring` pops a value from the stack, calls `to_s` on that value and then pushes the result back to the stack.

It has various fast paths for classes like String, Symbol, Module, Class, etc. For everything else it calls ‘to_s`.

### Usage

~~~ruby “#{5}” ~~~

Attributes

calldata[R]

Public Class Methods

new(calldata) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2565
def initialize(calldata)
  @calldata = calldata
end

Public Instance Methods

==(other) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2581
def ==(other)
  other.is_a?(ObjToString) && other.calldata == calldata
end
call(vm) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2597
def call(vm)
  vm.push(vm.pop.to_s)
end
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2577
def deconstruct_keys(_keys)
  { calldata: calldata }
end
disasm(fmt) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2569
def disasm(fmt)
  fmt.instruction("objtostring", [fmt.calldata(calldata)])
end
length() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2585
def length
  2
end
pops() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2589
def pops
  1
end
pushes() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2593
def pushes
  1
end
to_a(_iseq) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2573
def to_a(_iseq)
  [:objtostring, calldata.to_h]
end