class SyntaxTree::YARV::OptNewArraySend
### Summary
‘opt_newarray_send` is a specialization that occurs when a dynamic array literal is created and immediately sent the `min`, `max`, or `hash` methods. It pops the values of the array off the stack and pushes on the result of the method call.
### Usage
~~~ruby [a, b, c].max ~~~
Attributes
Public Class Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 3888 def initialize(number, method) @number = number @method = method end
Public Instance Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 3908 def ==(other) other.is_a?(OptNewArraySend) && other.number == number && other.method == method end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 3925 def call(vm) vm.push(vm.pop(number).__send__(method)) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 3904 def deconstruct_keys(_keys) { number: number, method: method } end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 3893 def disasm(fmt) fmt.instruction( "opt_newarray_send", [fmt.object(number), fmt.object(method)] ) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 3900 def to_a(_iseq) [:opt_newarray_send, number, method] end