Methods
Attributes
| [R] | buffer |
Public Class methods
[ show source ]
# File lib/rqrcode/qrcode/qr_bit_buffer.rb, line 17
17: def initialize
18: @buffer = []
19: @length = 0
20: end
Public Instance methods
[ show 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
[ show source ]
# File lib/rqrcode/qrcode/qr_bit_buffer.rb, line 36
36: def get_length_in_bits
37: @length
38: end
[ show 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
[ show 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