Class: SyntaxTree::YARV::Intern
- Inherits:
-
Object
- Object
- SyntaxTree::YARV::Intern
- Defined in:
- lib/syntax_tree/yarv/instructions.rb
Overview
### Summary
intern converts the top element of the stack to a symbol and pushes the symbol onto the stack.
### Usage
~~~ruby :“#”foo“” ~~~
Instance Method Summary collapse
- #==(other) ⇒ Object
- #call(vm) ⇒ Object
- #canonical ⇒ Object
- #deconstruct_keys(_keys) ⇒ Object
- #disasm(fmt) ⇒ Object
- #length ⇒ Object
- #pops ⇒ Object
- #pushes ⇒ Object
- #to_a(_iseq) ⇒ Object
Instance Method Details
#==(other) ⇒ Object
2179 2180 2181 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2179 def ==(other) other.is_a?(Intern) end |
#call(vm) ⇒ Object
2199 2200 2201 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2199 def call(vm) vm.push(vm.pop.to_sym) end |
#canonical ⇒ Object
2195 2196 2197 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2195 def canonical self end |
#deconstruct_keys(_keys) ⇒ Object
2175 2176 2177 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2175 def deconstruct_keys(_keys) {} end |
#disasm(fmt) ⇒ Object
2167 2168 2169 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2167 def disasm(fmt) fmt.instruction("intern") end |
#length ⇒ Object
2183 2184 2185 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2183 def length 1 end |
#pops ⇒ Object
2187 2188 2189 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2187 def pops 1 end |
#pushes ⇒ Object
2191 2192 2193 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2191 def pushes 1 end |
#to_a(_iseq) ⇒ Object
2171 2172 2173 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2171 def to_a(_iseq) [:intern] end |