Class: Header

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-doom.rb

Constant Summary collapse

BYTES_EACH =
12

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type = nil) ⇒ Header

Returns a new instance of Header.



652
653
654
# File 'lib/ruby-doom.rb', line 652

def initialize(type=nil)  
  @type = type
end

Instance Attribute Details

#directory_offsetObject

Returns the value of attribute directory_offset.



651
652
653
# File 'lib/ruby-doom.rb', line 651

def directory_offset
  @directory_offset
end

#lump_countObject

Returns the value of attribute lump_count.



651
652
653
# File 'lib/ruby-doom.rb', line 651

def lump_count
  @lump_count
end

#typeObject (readonly)

Returns the value of attribute type.



650
651
652
# File 'lib/ruby-doom.rb', line 650

def type
  @type
end

Instance Method Details

#read(array) ⇒ Object



655
656
657
# File 'lib/ruby-doom.rb', line 655

def read(array)
  @type, @lump_count, @directory_offset = Codec.decode("4ll", array)
end

#writeObject



658
659
660
# File 'lib/ruby-doom.rb', line 658

def write
  Codec.encode("4ll", [@type, @lump_count, @directory_offset])
end