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
Public Class Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 2618 def initialize(calldata) @calldata = calldata end
Public Instance Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 2634 def ==(other) other.is_a?(ObjToString) && other.calldata == calldata end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 2650 def call(vm) vm.push(vm.pop.to_s) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 2630 def deconstruct_keys(_keys) { calldata: calldata } end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 2622 def disasm(fmt) fmt.instruction("objtostring", [fmt.calldata(calldata)]) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 2626 def to_a(_iseq) [:objtostring, calldata.to_h] end