Class: RQRCode::QR8bitByte
- Inherits:
-
Object
- Object
- RQRCode::QR8bitByte
- Defined in:
- lib/rqrcode/qrcode/qr_8bit_byte.rb
Instance Attribute Summary collapse
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
Instance Method Summary collapse
- #get_length ⇒ Object
-
#initialize(data) ⇒ QR8bitByte
constructor
A new instance of QR8bitByte.
- #write(buffer) ⇒ Object
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
#mode ⇒ Object (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_length ⇒ Object
23 24 25 |
# File 'lib/rqrcode/qrcode/qr_8bit_byte.rb', line 23 def get_length @data.size end |
#write(buffer) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/rqrcode/qrcode/qr_8bit_byte.rb', line 28 def write( buffer ) ( 0...@data.size ).each do |i| c = @data[i] c = c.ord if c.respond_to?(:ord)#String#[] returns single-char string in 1.9, .ord gets ASCII pos buffer.put( c, 8 ) end end |