class SyntaxTree::YARV::OptStrFreeze
### Summary
‘opt_str_freeze` pushes a frozen known string value with no interpolation onto the stack using the freeze method. If the method gets overridden, this will fall back to a send.
### Usage
~~~ruby “hello”.freeze ~~~
Attributes
calldata[R]
object[R]
Public Class Methods
new(object, calldata)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4287 def initialize(object, calldata) @object = object @calldata = calldata end
Public Instance Methods
==(other)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4307 def ==(other) other.is_a?(OptStrFreeze) && other.object == object && other.calldata == calldata end
call(vm)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4320 def call(vm) vm.push(object.freeze) end
deconstruct_keys(_keys)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4303 def deconstruct_keys(_keys) { object: object, calldata: calldata } end
disasm(fmt)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4292 def disasm(fmt) fmt.instruction( "opt_str_freeze", [fmt.object(object), fmt.calldata(calldata)] ) end
length()
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4312 def length 3 end
pushes()
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4316 def pushes 1 end
to_a(_iseq)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 4299 def to_a(_iseq) [:opt_str_freeze, object, calldata.to_h] end