Class: DecodedLump

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

Direct Known Subclasses

Linedefs, Sectors, Sidedefs, Things, Vertexes

Instance Attribute Summary collapse

Attributes inherited from Lump

#name

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ DecodedLump

Returns a new instance of DecodedLump.



363
364
365
366
367
# File 'lib/ruby-doom.rb', line 363

def initialize(name)
  super(name)
  @items = []
  @index = 0
end

Instance Attribute Details

#itemsObject (readonly)

Returns the value of attribute items.



362
363
364
# File 'lib/ruby-doom.rb', line 362

def items
  @items
end

Instance Method Details

#add(i) ⇒ Object



368
369
370
371
372
373
# File 'lib/ruby-doom.rb', line 368

def add(i)
  i.id = @index
  @index += 1
  @items << i
  return i
end

#writeObject



374
375
376
377
378
# File 'lib/ruby-doom.rb', line 374

def write
  out = []
  @items.each {|i| out += i.write }
  out
end