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.



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

def initialize(io)
  @io = io
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args, &block) ⇒ Object



54
55
56
# File 'lib/bindata/alignment.rb', line 54

def method_missing(sym, *args, &block)
  @io.send(sym, *args, &block)
end

Instance Method Details

#readbytes(n) ⇒ Object



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

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