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