Class: Linedefs

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

Constant Summary collapse

BYTES_EACH =
14
NAME =
"LINEDEFS"

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

#initializeLinedefs

Returns a new instance of Linedefs.



574
575
576
# File 'lib/ruby-doom.rb', line 574

def initialize
  super(NAME)
end

Instance Method Details

#read(bytes) ⇒ Object



577
578
579
580
581
582
583
# File 'lib/ruby-doom.rb', line 577

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

#sizeObject



584
585
586
# File 'lib/ruby-doom.rb', line 584

def size
  @items.size * BYTES_EACH
end