Class RQRCode::QRBitBuffer
In: lib/rqrcode/qrcode/qr_bit_buffer.rb
Parent: Object
RuntimeError QRCodeRunTimeError ArgumentError QRCodeArgumentError QRBitBuffer QR8bitByte QRMath QRRSBlock QRUtil QRPolynomial QRCode lib/rqrcode/qrcode/qr_bit_buffer.rb lib/rqrcode/qrcode/qr_8bit_byte.rb lib/rqrcode/qrcode/qr_math.rb lib/rqrcode/qrcode/qr_rs_block.rb lib/rqrcode/qrcode/qr_util.rb lib/rqrcode/qrcode/qr_polynomial.rb lib/rqrcode/qrcode/qr_code.rb RQRCode dot/m_11_0.png

Methods

get   get_length_in_bits   new   put   put_bit  

Attributes

buffer  [R] 

Public Class methods

[Source]

    # File lib/rqrcode/qrcode/qr_bit_buffer.rb, line 17
17:     def initialize
18:       @buffer = []
19:       @length = 0
20:     end

Public Instance methods

[Source]

    # File lib/rqrcode/qrcode/qr_bit_buffer.rb, line 23
23:     def get( index )
24:       buf_index = (index / 8).floor
25:       (( (@buffer[buf_index]).rszf(7 - index % 8)) & 1) == 1
26:     end

[Source]

    # File lib/rqrcode/qrcode/qr_bit_buffer.rb, line 36
36:     def get_length_in_bits
37:       @length
38:     end

[Source]

    # File lib/rqrcode/qrcode/qr_bit_buffer.rb, line 29
29:     def put( num, length )
30:       ( 0...length ).each do |i|
31:         put_bit((((num).rszf(length - i - 1)) & 1) == 1)
32:       end
33:     end

[Source]

    # File lib/rqrcode/qrcode/qr_bit_buffer.rb, line 41
41:     def put_bit( bit )
42:       buf_index = ( @length / 8 ).floor
43:       if @buffer.size <= buf_index
44:         @buffer << 0
45:       end
46: 
47:       if bit
48:         @buffer[buf_index] |= ((0x80).rszf(@length % 8))
49:       end
50: 
51:       @length += 1
52:     end

[Validate]