Class: RQRCodeCore::QR8bitByte

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ QR8bitByte

Returns a new instance of QR8bitByte.



7
8
9
10
# File 'lib/rqrcode_core/qrcode/qr_8bit_byte.rb', line 7

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

Instance Attribute Details

#modeObject (readonly)

Returns the value of attribute mode.



5
6
7
# File 'lib/rqrcode_core/qrcode/qr_8bit_byte.rb', line 5

def mode
  @mode
end

Instance Method Details

#get_lengthObject



13
14
15
# File 'lib/rqrcode_core/qrcode/qr_8bit_byte.rb', line 13

def get_length
  @data.bytesize
end

#write(buffer) ⇒ Object



18
19
20
21
22
23
# File 'lib/rqrcode_core/qrcode/qr_8bit_byte.rb', line 18

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