rqrcode 0.10.1 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ruby.yml +28 -0
- data/.gitignore +13 -0
- data/.rspec +2 -0
- data/CHANGELOG.md +79 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +72 -0
- data/LICENSE.txt +21 -0
- data/README.md +223 -135
- data/Rakefile +10 -0
- data/_config.yml +1 -0
- data/bin/console +14 -0
- data/images/ansi-screen-shot.png +0 -0
- data/images/github-qrcode.png +0 -0
- data/images/github-qrcode.svg +32 -0
- data/lib/rqrcode/export/ansi.rb +22 -25
- data/lib/rqrcode/export/html.rb +8 -10
- data/lib/rqrcode/export/png.rb +62 -46
- data/lib/rqrcode/export/svg.rb +180 -24
- data/lib/rqrcode/export.rb +6 -0
- data/lib/rqrcode/qrcode/qrcode.rb +17 -0
- data/lib/rqrcode/qrcode.rb +3 -4
- data/lib/rqrcode/version.rb +3 -1
- data/lib/rqrcode.rb +8 -19
- data/rqrcode.gemspec +39 -0
- metadata +90 -60
- data/CHANGELOG +0 -97
- data/LICENSE +0 -19
- data/lib/rqrcode/core_ext/array/behavior.rb +0 -12
- data/lib/rqrcode/core_ext/array.rb +0 -5
- data/lib/rqrcode/core_ext/integer/bitwise.rb +0 -13
- data/lib/rqrcode/core_ext/integer.rb +0 -5
- data/lib/rqrcode/core_ext.rb +0 -5
- data/lib/rqrcode/qrcode/qr_8bit_byte.rb +0 -36
- data/lib/rqrcode/qrcode/qr_alphanumeric.rb +0 -47
- data/lib/rqrcode/qrcode/qr_bit_buffer.rb +0 -99
- data/lib/rqrcode/qrcode/qr_code.rb +0 -585
- data/lib/rqrcode/qrcode/qr_math.rb +0 -63
- data/lib/rqrcode/qrcode/qr_numeric.rb +0 -57
- data/lib/rqrcode/qrcode/qr_polynomial.rb +0 -78
- data/lib/rqrcode/qrcode/qr_rs_block.rb +0 -314
- data/lib/rqrcode/qrcode/qr_util.rb +0 -272
- data/test/data.rb +0 -25
- data/test/test_helper.rb +0 -5
- data/test/test_regresions.rb +0 -10
- data/test/test_rqrcode.rb +0 -155
- data/test/test_rqrcode_export.rb +0 -27
metadata
CHANGED
@@ -1,126 +1,156 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rqrcode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Björn Blomqvist
|
8
7
|
- Duncan Robertson
|
9
|
-
autorequire:
|
10
|
-
bindir:
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2023-05-17 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rqrcode_core
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
14
27
|
- !ruby/object:Gem::Dependency
|
15
28
|
name: chunky_png
|
16
29
|
requirement: !ruby/object:Gem::Requirement
|
17
30
|
requirements:
|
18
|
-
- - ~>
|
31
|
+
- - "~>"
|
19
32
|
- !ruby/object:Gem::Version
|
20
33
|
version: '1.0'
|
21
34
|
type: :runtime
|
22
35
|
prerelease: false
|
23
36
|
version_requirements: !ruby/object:Gem::Requirement
|
24
37
|
requirements:
|
25
|
-
- - ~>
|
38
|
+
- - "~>"
|
26
39
|
- !ruby/object:Gem::Version
|
27
40
|
version: '1.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.0'
|
28
55
|
- !ruby/object:Gem::Dependency
|
29
56
|
name: rake
|
30
57
|
requirement: !ruby/object:Gem::Requirement
|
31
58
|
requirements:
|
32
|
-
- -
|
59
|
+
- - "~>"
|
33
60
|
- !ruby/object:Gem::Version
|
34
|
-
version: '0'
|
61
|
+
version: '13.0'
|
35
62
|
type: :development
|
36
63
|
prerelease: false
|
37
64
|
version_requirements: !ruby/object:Gem::Requirement
|
38
65
|
requirements:
|
39
|
-
- -
|
66
|
+
- - "~>"
|
40
67
|
- !ruby/object:Gem::Version
|
41
|
-
version: '0'
|
68
|
+
version: '13.0'
|
42
69
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.5'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.5'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: standardrb
|
44
85
|
requirement: !ruby/object:Gem::Requirement
|
45
86
|
requirements:
|
46
|
-
- -
|
87
|
+
- - "~>"
|
47
88
|
- !ruby/object:Gem::Version
|
48
|
-
version: 1.0
|
89
|
+
version: '1.0'
|
49
90
|
type: :development
|
50
91
|
prerelease: false
|
51
92
|
version_requirements: !ruby/object:Gem::Requirement
|
52
93
|
requirements:
|
53
|
-
- -
|
94
|
+
- - "~>"
|
54
95
|
- !ruby/object:Gem::Version
|
55
|
-
version: 1.0
|
96
|
+
version: '1.0'
|
56
97
|
description: |
|
57
|
-
|
98
|
+
rqrcode is a library for encoding QR Codes. The simple
|
58
99
|
interface allows you to create QR Code data structures
|
59
|
-
|
100
|
+
and then render them in the way you choose.
|
60
101
|
email:
|
61
|
-
-
|
102
|
+
- duncan@whomwah.com
|
62
103
|
executables: []
|
63
104
|
extensions: []
|
64
|
-
extra_rdoc_files:
|
65
|
-
- README.md
|
66
|
-
- CHANGELOG
|
67
|
-
- LICENSE
|
105
|
+
extra_rdoc_files: []
|
68
106
|
files:
|
69
|
-
-
|
70
|
-
-
|
107
|
+
- ".github/workflows/ruby.yml"
|
108
|
+
- ".gitignore"
|
109
|
+
- ".rspec"
|
110
|
+
- CHANGELOG.md
|
111
|
+
- Gemfile
|
112
|
+
- Gemfile.lock
|
113
|
+
- LICENSE.txt
|
71
114
|
- README.md
|
115
|
+
- Rakefile
|
116
|
+
- _config.yml
|
117
|
+
- bin/console
|
118
|
+
- images/ansi-screen-shot.png
|
119
|
+
- images/github-qrcode.png
|
120
|
+
- images/github-qrcode.svg
|
72
121
|
- lib/rqrcode.rb
|
73
|
-
- lib/rqrcode/
|
74
|
-
- lib/rqrcode/core_ext/array.rb
|
75
|
-
- lib/rqrcode/core_ext/array/behavior.rb
|
76
|
-
- lib/rqrcode/core_ext/integer.rb
|
77
|
-
- lib/rqrcode/core_ext/integer/bitwise.rb
|
122
|
+
- lib/rqrcode/export.rb
|
78
123
|
- lib/rqrcode/export/ansi.rb
|
79
124
|
- lib/rqrcode/export/html.rb
|
80
125
|
- lib/rqrcode/export/png.rb
|
81
126
|
- lib/rqrcode/export/svg.rb
|
82
127
|
- lib/rqrcode/qrcode.rb
|
83
|
-
- lib/rqrcode/qrcode/
|
84
|
-
- lib/rqrcode/qrcode/qr_alphanumeric.rb
|
85
|
-
- lib/rqrcode/qrcode/qr_bit_buffer.rb
|
86
|
-
- lib/rqrcode/qrcode/qr_code.rb
|
87
|
-
- lib/rqrcode/qrcode/qr_math.rb
|
88
|
-
- lib/rqrcode/qrcode/qr_numeric.rb
|
89
|
-
- lib/rqrcode/qrcode/qr_polynomial.rb
|
90
|
-
- lib/rqrcode/qrcode/qr_rs_block.rb
|
91
|
-
- lib/rqrcode/qrcode/qr_util.rb
|
128
|
+
- lib/rqrcode/qrcode/qrcode.rb
|
92
129
|
- lib/rqrcode/version.rb
|
93
|
-
-
|
94
|
-
- test/test_helper.rb
|
95
|
-
- test/test_regresions.rb
|
96
|
-
- test/test_rqrcode.rb
|
97
|
-
- test/test_rqrcode_export.rb
|
130
|
+
- rqrcode.gemspec
|
98
131
|
homepage: https://github.com/whomwah/rqrcode
|
99
|
-
licenses:
|
100
|
-
|
101
|
-
|
132
|
+
licenses:
|
133
|
+
- MIT
|
134
|
+
metadata:
|
135
|
+
bug_tracker_uri: https://github.com/whomwah/rqrcode/issues
|
136
|
+
changelog_uri: https://github.com/whomwah/rqrcode/blob/master/CHANGELOG.md
|
137
|
+
post_install_message:
|
102
138
|
rdoc_options: []
|
103
139
|
require_paths:
|
104
140
|
- lib
|
105
141
|
required_ruby_version: !ruby/object:Gem::Requirement
|
106
142
|
requirements:
|
107
|
-
- -
|
143
|
+
- - ">="
|
108
144
|
- !ruby/object:Gem::Version
|
109
|
-
version: '
|
145
|
+
version: '2.6'
|
110
146
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
147
|
requirements:
|
112
|
-
- -
|
148
|
+
- - ">="
|
113
149
|
- !ruby/object:Gem::Version
|
114
|
-
version:
|
150
|
+
version: '0'
|
115
151
|
requirements: []
|
116
|
-
|
117
|
-
|
118
|
-
signing_key:
|
152
|
+
rubygems_version: 3.4.6
|
153
|
+
signing_key:
|
119
154
|
specification_version: 4
|
120
155
|
summary: A library to encode QR Codes
|
121
|
-
test_files:
|
122
|
-
- test/data.rb
|
123
|
-
- test/test_helper.rb
|
124
|
-
- test/test_regresions.rb
|
125
|
-
- test/test_rqrcode.rb
|
126
|
-
- test/test_rqrcode_export.rb
|
156
|
+
test_files: []
|
data/CHANGELOG
DELETED
@@ -1,97 +0,0 @@
|
|
1
|
-
*0.10.1* (Feb 11, 2016)
|
2
|
-
|
3
|
-
- Changed so that gem wont include images and tests.
|
4
|
-
|
5
|
-
*0.10.0* (Feb 11, 2016)
|
6
|
-
|
7
|
-
- Merged as_ansi by [Andy Brody](https://github.com/ab)
|
8
|
-
|
9
|
-
*0.8.2* (Jan 3, 2016)
|
10
|
-
|
11
|
-
- Fix source encoding problem introduced in 0.8.1
|
12
|
-
|
13
|
-
*0.9.0* (Jan 3, 2016)
|
14
|
-
|
15
|
-
- Added support for auto selecting qrcode size up to level 40. (only worked up to level 10 before)
|
16
|
-
- Added numeric support during auto selection of qrcode mode.
|
17
|
-
|
18
|
-
*0.8.1* (Jan 3, 2016)
|
19
|
-
|
20
|
-
- Remove active support specific `present?`.
|
21
|
-
- Fix so that all tests are run.
|
22
|
-
|
23
|
-
*0.8.0* (Dec 18, 2015)
|
24
|
-
|
25
|
-
- Added numeric QR code support
|
26
|
-
- Dropped Ruby v1.8 support
|
27
|
-
|
28
|
-
*0.7.0* (Aug 15, 2015)
|
29
|
-
|
30
|
-
- Added shape_rendering option for as_svg
|
31
|
-
|
32
|
-
*0.6.0* (Jun 2, 2015)
|
33
|
-
|
34
|
-
- Improved png rendering. Previous png rendering could result in hard to scan qrcodes.
|
35
|
-
*Big thanks to Bart Jedrocha*
|
36
|
-
|
37
|
-
*0.5.5* (Apr 25, 2015)
|
38
|
-
|
39
|
-
- Fixed major bug. The rs block data was missing resulting in qr codes failing to be generated.
|
40
|
-
*Upgrade highly recomended!!*
|
41
|
-
|
42
|
-
*0.5.4* (Nov 11th, 2013)
|
43
|
-
|
44
|
-
* Added as_html, Big thanks to Jon Evans!
|
45
|
-
|
46
|
-
*0.4.2* (Sep 1st, 2011)
|
47
|
-
|
48
|
-
* Proper namespace CoreExtensions and only extend when needed [https://github.com/metaskills]
|
49
|
-
* fix for running tests on 1.9
|
50
|
-
|
51
|
-
*0.4.1* (Aug 16th, 2011)
|
52
|
-
|
53
|
-
* Compute common patterns only once (5% to 10% speedup) [https://github.com/gioele]
|
54
|
-
|
55
|
-
*0.4.0* (Aug 13th, 2011)
|
56
|
-
|
57
|
-
* Code optimization: 30% speedup [https://github.com/gioele]
|
58
|
-
* refactor gem layout
|
59
|
-
|
60
|
-
*0.3.4* (May 23rd, 2011)
|
61
|
-
|
62
|
-
* add the more Rubyish QRCode#dark? alias for #is_dark [https://github.com/dasch]
|
63
|
-
|
64
|
-
*0.3.3* (Feb 1st, 2011)
|
65
|
-
|
66
|
-
* check to see if the level is valid
|
67
|
-
* fix for 'rszf' bug by [Rob la Lau https://github.com/ohreally]
|
68
|
-
|
69
|
-
*0.3.2* (Mar 15th, 2009)
|
70
|
-
|
71
|
-
* Ruby 1.9 fixes by [Tore Darell http://tore.darell.no] [Chris Mowforth http://blog.99th.st]
|
72
|
-
|
73
|
-
*0.3.1* (Nov 24th, 2008)
|
74
|
-
|
75
|
-
* expanded RS block table to QRcode version 40 [Vladislav Gorodetskiy]
|
76
|
-
|
77
|
-
*0.3.0* (Feb 28th, 2008)
|
78
|
-
|
79
|
-
* added more documentation
|
80
|
-
* changed to_console to to_s (what was I thinking)
|
81
|
-
* add more tests
|
82
|
-
|
83
|
-
*0.2.1* (Feb 24th, 2008)
|
84
|
-
|
85
|
-
* small changes to rakefile and readme
|
86
|
-
* small change to to_console method
|
87
|
-
* make console_count method private (use modules.size instead)
|
88
|
-
* slowy updating rdocs
|
89
|
-
|
90
|
-
*0.2.0* (Feb 23rd, 2008)
|
91
|
-
|
92
|
-
* Split files up [DR]
|
93
|
-
* added rdoc comment ... more to do there
|
94
|
-
|
95
|
-
*0.1.0* (Feb 22rd, 2008)
|
96
|
-
|
97
|
-
* Initial Release [DR]
|
data/LICENSE
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
Copyright (c) 2008 Duncan Robertson
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
of this software and associated documentation files (the "Software"), to
|
5
|
-
deal in the Software without restriction, including without limitation the
|
6
|
-
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
7
|
-
sell copies of the Software, and to permit persons to whom the Software is
|
8
|
-
furnished to do so, subject to the following conditions:
|
9
|
-
|
10
|
-
The above copyright notice and this permission notice shall be included in
|
11
|
-
all copies or substantial portions of the Software.
|
12
|
-
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
16
|
-
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
17
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
18
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
19
|
-
|
data/lib/rqrcode/core_ext.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
#--
|
4
|
-
# Copyright 2004 by Duncan Robertson (duncan@whomwah.com).
|
5
|
-
# All rights reserved.
|
6
|
-
|
7
|
-
# Permission is granted for use, copying, modification, distribution,
|
8
|
-
# and distribution of modified versions of this work as long as the
|
9
|
-
# above copyright notice is included.
|
10
|
-
#++
|
11
|
-
|
12
|
-
module RQRCode
|
13
|
-
|
14
|
-
class QR8bitByte
|
15
|
-
attr_reader :mode
|
16
|
-
|
17
|
-
def initialize( data )
|
18
|
-
@mode = QRMODE[:mode_8bit_byte]
|
19
|
-
@data = data;
|
20
|
-
end
|
21
|
-
|
22
|
-
|
23
|
-
def get_length
|
24
|
-
@data.bytesize
|
25
|
-
end
|
26
|
-
|
27
|
-
|
28
|
-
def write( buffer)
|
29
|
-
buffer.byte_encoding_start(get_length)
|
30
|
-
@data.each_byte do |b|
|
31
|
-
buffer.put(b, 8)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
module RQRCode
|
2
|
-
|
3
|
-
ALPHANUMERIC = ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',' ','$','%','*','+','-','.','/',':']
|
4
|
-
|
5
|
-
class QRAlphanumeric
|
6
|
-
attr_reader :mode
|
7
|
-
|
8
|
-
def initialize( data )
|
9
|
-
@mode = QRMODE[:mode_alpha_numk]
|
10
|
-
|
11
|
-
raise QRCodeArgumentError, "Not a alpha numeric uppercase string `#{data}`" unless QRAlphanumeric.valid_data?(data)
|
12
|
-
|
13
|
-
@data = data;
|
14
|
-
end
|
15
|
-
|
16
|
-
|
17
|
-
def get_length
|
18
|
-
@data.size
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.valid_data? data
|
22
|
-
data.each_char do |s|
|
23
|
-
return false if ALPHANUMERIC.index(s).nil?
|
24
|
-
end
|
25
|
-
true
|
26
|
-
end
|
27
|
-
|
28
|
-
|
29
|
-
def write( buffer)
|
30
|
-
buffer.alphanumeric_encoding_start(get_length)
|
31
|
-
|
32
|
-
(@data.size).times do |i|
|
33
|
-
if i % 2 == 0
|
34
|
-
if i == (@data.size - 1)
|
35
|
-
value = ALPHANUMERIC.index(@data[i])
|
36
|
-
buffer.put( value, 6 )
|
37
|
-
else
|
38
|
-
value = (ALPHANUMERIC.index(@data[i]) * 45) + ALPHANUMERIC.index(@data[i+1])
|
39
|
-
buffer.put( value, 11 )
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,99 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
#--
|
4
|
-
# Copyright 2004 by Duncan Robertson (duncan@whomwah.com).
|
5
|
-
# All rights reserved.
|
6
|
-
|
7
|
-
# Permission is granted for use, copying, modification, distribution,
|
8
|
-
# and distribution of modified versions of this work as long as the
|
9
|
-
# above copyright notice is included.
|
10
|
-
#++
|
11
|
-
|
12
|
-
module RQRCode
|
13
|
-
|
14
|
-
class QRBitBuffer
|
15
|
-
attr_reader :buffer
|
16
|
-
|
17
|
-
PAD0 = 0xEC
|
18
|
-
PAD1 = 0x11
|
19
|
-
|
20
|
-
def initialize(version)
|
21
|
-
@version = version
|
22
|
-
@buffer = []
|
23
|
-
@length = 0
|
24
|
-
end
|
25
|
-
|
26
|
-
|
27
|
-
def get( index )
|
28
|
-
buf_index = (index / 8).floor
|
29
|
-
(( (@buffer[buf_index]).rszf(7 - index % 8)) & 1) == 1
|
30
|
-
end
|
31
|
-
|
32
|
-
|
33
|
-
def put( num, length )
|
34
|
-
( 0...length ).each do |i|
|
35
|
-
put_bit((((num).rszf(length - i - 1)) & 1) == 1)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
|
40
|
-
def get_length_in_bits
|
41
|
-
@length
|
42
|
-
end
|
43
|
-
|
44
|
-
|
45
|
-
def put_bit( bit )
|
46
|
-
buf_index = ( @length / 8 ).floor
|
47
|
-
if @buffer.size <= buf_index
|
48
|
-
@buffer << 0
|
49
|
-
end
|
50
|
-
|
51
|
-
if bit
|
52
|
-
@buffer[buf_index] |= ((0x80).rszf(@length % 8))
|
53
|
-
end
|
54
|
-
|
55
|
-
@length += 1
|
56
|
-
end
|
57
|
-
|
58
|
-
def byte_encoding_start(length)
|
59
|
-
|
60
|
-
put( QRMODE[:mode_8bit_byte], 4 )
|
61
|
-
put(length, QRUtil.get_length_in_bits(QRMODE[:mode_8bit_byte], @version))
|
62
|
-
|
63
|
-
end
|
64
|
-
|
65
|
-
def alphanumeric_encoding_start(length)
|
66
|
-
|
67
|
-
put( QRMODE[:mode_alpha_numk], 4 )
|
68
|
-
put(length, QRUtil.get_length_in_bits(QRMODE[:mode_alpha_numk], @version))
|
69
|
-
|
70
|
-
end
|
71
|
-
|
72
|
-
def numeric_encoding_start(length)
|
73
|
-
|
74
|
-
put( QRMODE[:mode_number], 4 )
|
75
|
-
put(length, QRUtil.get_length_in_bits(QRMODE[:mode_number], @version))
|
76
|
-
|
77
|
-
end
|
78
|
-
|
79
|
-
def pad_until(prefered_size)
|
80
|
-
# Align on byte
|
81
|
-
while get_length_in_bits % 8 != 0
|
82
|
-
put_bit( false )
|
83
|
-
end
|
84
|
-
|
85
|
-
# Pad with padding code words
|
86
|
-
while get_length_in_bits < prefered_size
|
87
|
-
put( QRBitBuffer::PAD0, 8 )
|
88
|
-
put( QRBitBuffer::PAD1, 8 ) if get_length_in_bits < prefered_size
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
def end_of_message(max_data_bits)
|
93
|
-
put( 0, 4 ) unless get_length_in_bits+4 > max_data_bits
|
94
|
-
end
|
95
|
-
|
96
|
-
|
97
|
-
end
|
98
|
-
|
99
|
-
end
|