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
Public Class Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 4340 def initialize(object, calldata) @object = object @calldata = calldata end
Public Instance Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 4360 def ==(other) other.is_a?(OptStrFreeze) && other.object == object && other.calldata == calldata end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 4373 def call(vm) vm.push(object.freeze) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 4356 def deconstruct_keys(_keys) { object: object, calldata: calldata } end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 4345 def disasm(fmt) fmt.instruction( "opt_str_freeze", [fmt.object(object), fmt.calldata(calldata)] ) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 4352 def to_a(_iseq) [:opt_str_freeze, object, calldata.to_h] end