Class: RQRCode::QR8bitByte

Inherits:
Object
  • Object
show all
Defined in:
lib/rqrcode/qrcode/qr_8bit_byte.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ QR8bitByte

Returns a new instance of QR8bitByte.



17
18
19
20
# File 'lib/rqrcode/qrcode/qr_8bit_byte.rb', line 17

def initialize( data )
  @mode = QRMODE[:mode_8bit_byte]
  @data = data;
end

Instance Attribute Details

#modeObject (readonly)

Returns the value of attribute mode.



15
16
17
# File 'lib/rqrcode/qrcode/qr_8bit_byte.rb', line 15

def mode
  @mode
end

Instance Method Details

#get_lengthObject



23
24
25
# File 'lib/rqrcode/qrcode/qr_8bit_byte.rb', line 23

def get_length
  @data.bytesize
end

#write(buffer) ⇒ Object



28
29
30
31
32
33
# File 'lib/rqrcode/qrcode/qr_8bit_byte.rb', line 28

def write( buffer)
  buffer.byte_encoding_start(get_length)
  @data.each_byte do |b|
    buffer.put(b, 8)
  end
end