Class: SyntaxTree::YARV::PutString
- Inherits:
-
Object
- Object
- SyntaxTree::YARV::PutString
- Defined in:
- lib/syntax_tree/yarv/instructions.rb
Overview
### Summary
putstring pushes an unfrozen string literal onto the stack.
### Usage
~~~ruby “foo” ~~~
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #call(vm) ⇒ Object
- #canonical ⇒ Object
- #deconstruct_keys(_keys) ⇒ Object
- #disasm(fmt) ⇒ Object
-
#initialize(object) ⇒ PutString
constructor
A new instance of PutString.
- #length ⇒ Object
- #pops ⇒ Object
- #pushes ⇒ Object
- #to_a(_iseq) ⇒ Object
Constructor Details
#initialize(object) ⇒ PutString
5101 5102 5103 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 5101 def initialize(object) @object = object end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
5099 5100 5101 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 5099 def object @object end |
Instance Method Details
#==(other) ⇒ Object
5117 5118 5119 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 5117 def ==(other) other.is_a?(PutString) && other.object == object end |
#call(vm) ⇒ Object
5137 5138 5139 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 5137 def call(vm) vm.push(object.dup) end |
#canonical ⇒ Object
5133 5134 5135 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 5133 def canonical self end |
#deconstruct_keys(_keys) ⇒ Object
5113 5114 5115 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 5113 def deconstruct_keys(_keys) { object: object } end |
#disasm(fmt) ⇒ Object
5105 5106 5107 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 5105 def disasm(fmt) fmt.instruction("putstring", [fmt.object(object)]) end |
#length ⇒ Object
5121 5122 5123 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 5121 def length 2 end |
#pops ⇒ Object
5125 5126 5127 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 5125 def pops 0 end |
#pushes ⇒ Object
5129 5130 5131 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 5129 def pushes 1 end |
#to_a(_iseq) ⇒ Object
5109 5110 5111 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 5109 def to_a(_iseq) [:putstring, object] end |