Class: BinData::BitAligned::BitAlignedIO

Inherits:
Object
  • Object
show all
Defined in:
lib/bindata/alignment.rb

Instance Method Summary collapse

Constructor Details

#initialize(io) ⇒ BitAlignedIO

Returns a new instance of BitAlignedIO.



45
46
47
# File 'lib/bindata/alignment.rb', line 45

def initialize(io)
  @io = io
end

Instance Method Details

#readbytes(n) ⇒ Object



48
49
50
51
52
# File 'lib/bindata/alignment.rb', line 48

def readbytes(n)
  n.times.inject("") do |bytes, _|
    bytes += @io.readbits(8, :big).chr
  end
end