Class: JvmBytecode::Constants::Ref
- Defined in:
- lib/jvm_bytecode/constants/ref.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#class_index ⇒ Object
readonly
Returns the value of attribute class_index.
-
#name_and_type_index ⇒ Object
readonly
Returns the value of attribute name_and_type_index.
Class Method Summary collapse
Instance Method Summary collapse
- #additional_bytecode ⇒ Object
-
#initialize(class_index, name_and_type_index) ⇒ Ref
constructor
A new instance of Ref.
- #to_hash ⇒ Object
Methods inherited from Constant
Constructor Details
#initialize(class_index, name_and_type_index) ⇒ Ref
Returns a new instance of Ref.
11 12 13 14 |
# File 'lib/jvm_bytecode/constants/ref.rb', line 11 def initialize(class_index, name_and_type_index) @class_index = class_index @name_and_type_index = name_and_type_index end |
Instance Attribute Details
#class_index ⇒ Object (readonly)
Returns the value of attribute class_index.
4 5 6 |
# File 'lib/jvm_bytecode/constants/ref.rb', line 4 def class_index @class_index end |
#name_and_type_index ⇒ Object (readonly)
Returns the value of attribute name_and_type_index.
4 5 6 |
# File 'lib/jvm_bytecode/constants/ref.rb', line 4 def name_and_type_index @name_and_type_index end |
Class Method Details
.decode(io) ⇒ Object
6 7 8 9 |
# File 'lib/jvm_bytecode/constants/ref.rb', line 6 def self.decode(io) indexes = io.read(4).unpack('S>2') new(*indexes) end |
Instance Method Details
#additional_bytecode ⇒ Object
16 17 18 |
# File 'lib/jvm_bytecode/constants/ref.rb', line 16 def additional_bytecode [@class_index, @name_and_type_index].pack('S>2') end |
#to_hash ⇒ Object
20 21 22 23 24 25 |
# File 'lib/jvm_bytecode/constants/ref.rb', line 20 def to_hash { class_index: @class_index, name_and_type_index: @name_and_type_index } end |