class BitStream::ReaderArray

Public Class Methods

new() click to toggle source
# File lib/bitstream.rb, line 142
def initialize
  @array = []
  @read  = []
end

Public Instance Methods

<<(reader) click to toggle source
# File lib/bitstream.rb, line 159
def <<(reader)
  @array << reader
end
[](pos) click to toggle source
# File lib/bitstream.rb, line 147
def [](pos)
  unless @read[pos]
    @read[pos] = true
    reader = @array[pos]
    if reader.value.nil?
      reader.read
    end
    @array[pos] = reader.value
  end
  return @array[pos]
end