class SyntaxTree::YARV::ConcatToArray
### Summary
‘concattoarray` pops a single value off the stack and attempts to concat it to the Array on top of the stack. If the value is not an Array, it will be coerced into one.
### Usage
~~~ruby
- 1, *2
-
~~~
Attributes
Public Class Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 775 def initialize(object) @object = object end
Public Instance Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 791 def ==(other) other.is_a?(ConcatToArray) && other.object == object end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 807 def call(vm) array, value = vm.pop(2) vm.push(array.concat(Array(value))) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 787 def deconstruct_keys(_keys) { object: object } end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 779 def disasm(fmt) fmt.instruction("concattoarray", [fmt.object(object)]) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 783 def to_a(_iseq) [:concattoarray, object] end