Class: Sectors

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

Constant Summary collapse

BYTES_EACH =
26
NAME =
"SECTORS"

Instance Attribute Summary

Attributes inherited from DecodedLump

#items

Attributes inherited from Lump

#name

Instance Method Summary collapse

Methods inherited from DecodedLump

#add, #write

Constructor Details

#initializeSectors

Returns a new instance of Sectors.



403
404
405
# File 'lib/ruby-doom.rb', line 403

def initialize
  super(NAME)
end

Instance Method Details

#read(bytes) ⇒ Object



406
407
408
409
410
411
412
# File 'lib/ruby-doom.rb', line 406

def read(bytes)
  (bytes.size / BYTES_EACH).times {|index|
    s = Sector.new
    s.read(bytes.slice(index*BYTES_EACH, BYTES_EACH))
    @items << s
  }
end

#sizeObject



413
414
415
# File 'lib/ruby-doom.rb', line 413

def size
  @items.size * BYTES_EACH
end