Class: JvmBytecode::Attributes::SourceFile

Inherits:
Attribute
  • Object
show all
Defined in:
lib/jvm_bytecode/attributes/source_file.rb

Instance Attribute Summary

Attributes inherited from Attribute

#cp

Instance Method Summary collapse

Methods inherited from Attribute

#bytecode, decode_serial, define, fetch, #initialize, locatable_at

Constructor Details

This class inherits a constructor from JvmBytecode::Attributes::Attribute

Instance Method Details

#additional_bytecodeObject



10
11
12
# File 'lib/jvm_bytecode/attributes/source_file.rb', line 10

def additional_bytecode
  [@filename].pack('S>')
end

#decode(io) ⇒ Object



14
15
16
17
# File 'lib/jvm_bytecode/attributes/source_file.rb', line 14

def decode(io)
  io.read(4) # discard length
  @filename = io.read(2).unpack('S>').first
end

#filename(f) ⇒ Object



6
7
8
# File 'lib/jvm_bytecode/attributes/source_file.rb', line 6

def filename(f)
  @filename = cp.index_or_utf8(f)
end

#to_hashObject



19
20
21
# File 'lib/jvm_bytecode/attributes/source_file.rb', line 19

def to_hash
  {}
end