class SyntaxTree::YARV::OptLength
### Summary
‘opt_length` is a specialization of `opt_send_without_block`, when the `length` method is called. There are fast paths when the receiver is either a string, hash, or array. It pops the receiver off the stack and pushes on the result of the method call.
### Usage
~~~ruby “”.length ~~~
Attributes
Public Class Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 3484 def initialize(calldata) @calldata = calldata end
Public Instance Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 3500 def ==(other) other.is_a?(OptLength) && other.calldata == calldata end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 3520 def call(vm) canonical.call(vm) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 3516 def canonical Send.new(calldata, nil) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 3496 def deconstruct_keys(_keys) { calldata: calldata } end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 3488 def disasm(fmt) fmt.instruction("opt_length", [fmt.calldata(calldata)]) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 3492 def to_a(_iseq) [:opt_length, calldata.to_h] end