class SyntaxTree::YARV::Legacy::OptNewArrayMin

### Summary

‘opt_newarray_min` is a specialization that occurs when the `min` method is called on an array literal. It pops the values of the array off the stack and pushes on the result.

### Usage

~~~ruby [a, b, c].min ~~~

Attributes

number[R]

Public Class Methods

new(number) click to toggle source
# File lib/syntax_tree/yarv/legacy.rb, line 194
def initialize(number)
  @number = number
end

Public Instance Methods

==(other) click to toggle source
# File lib/syntax_tree/yarv/legacy.rb, line 210
def ==(other)
  other.is_a?(OptNewArrayMin) && other.number == number
end
call(vm) click to toggle source
# File lib/syntax_tree/yarv/legacy.rb, line 226
def call(vm)
  vm.push(vm.pop(number).min)
end
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/yarv/legacy.rb, line 206
def deconstruct_keys(_keys)
  { number: number }
end
disasm(fmt) click to toggle source
# File lib/syntax_tree/yarv/legacy.rb, line 198
def disasm(fmt)
  fmt.instruction("opt_newarray_min", [fmt.object(number)])
end
length() click to toggle source
# File lib/syntax_tree/yarv/legacy.rb, line 214
def length
  2
end
pops() click to toggle source
# File lib/syntax_tree/yarv/legacy.rb, line 218
def pops
  number
end
pushes() click to toggle source
# File lib/syntax_tree/yarv/legacy.rb, line 222
def pushes
  1
end
to_a(_iseq) click to toggle source
# File lib/syntax_tree/yarv/legacy.rb, line 202
def to_a(_iseq)
  [:opt_newarray_min, number]
end