barby 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/barby +5 -4
- data/lib/barby/barcode.rb +13 -3
- data/lib/barby/barcode/qr_code.rb +16 -18
- data/lib/barby/outputter/prawn_outputter.rb +0 -1
- data/lib/barby/version.rb +1 -1
- data/vendor/rqrcode/CHANGELOG +4 -0
- data/vendor/rqrcode/Rakefile +1 -1
- data/vendor/rqrcode/lib/rqrcode/qrcode/qr_rs_block.rb +185 -6
- metadata +3 -3
data/bin/barby
CHANGED
@@ -7,7 +7,8 @@ require 'barby'
|
|
7
7
|
|
8
8
|
options = {
|
9
9
|
:outputter => 'Png',
|
10
|
-
:outputter_method => 'to_png'
|
10
|
+
:outputter_method => 'to_png',
|
11
|
+
:barcode => 'Code128B'
|
11
12
|
}
|
12
13
|
|
13
14
|
ARGV.options do |o|
|
@@ -18,9 +19,9 @@ ARGV.options do |o|
|
|
18
19
|
o.separator ' EXPERIMENTAL'
|
19
20
|
o.separator ''
|
20
21
|
|
21
|
-
o.on('-b', '--barcode=ClassName', String, 'Barcode type'){|v| options[:barcode] = v }
|
22
|
-
o.on('-o', '--outputter=ClassName', String, 'Outputter'){|v| options[:outputter] = v }
|
23
|
-
o.on('-m', '--method=method_name', String, 'Outputter method'){|v| options[:outputter_method] = v }
|
22
|
+
o.on('-b', '--barcode=ClassName', String, 'Barcode type (Code128B)'){|v| options[:barcode] = v }
|
23
|
+
o.on('-o', '--outputter=ClassName', String, 'Outputter (Png)'){|v| options[:outputter] = v }
|
24
|
+
o.on('-m', '--method=method_name', String, 'Outputter method (to_png)'){|v| options[:outputter_method] = v }
|
24
25
|
|
25
26
|
o.on_tail("-h", "--help", "Show this help message.") { puts o; exit }
|
26
27
|
|
data/lib/barby/barcode.rb
CHANGED
@@ -24,12 +24,23 @@ module Barby
|
|
24
24
|
# # ## ### #### #
|
25
25
|
# # ## ### #### #
|
26
26
|
# # ## ### #### #
|
27
|
+
#
|
28
|
+
#2D implementation:
|
29
|
+
#
|
30
|
+
# class Static2DBarcode < Barby::Barcode2D
|
31
|
+
# def encoding
|
32
|
+
# ['1010101', '010101110', '0001010100']
|
33
|
+
# end
|
34
|
+
# end
|
27
35
|
class Barcode
|
28
36
|
|
29
37
|
|
30
38
|
#Every barcode must have an encoding method. This method returns
|
31
39
|
#a string containing a series of 1 and 0, representing bars and
|
32
40
|
#spaces. One digit is the width of one "module" or X dimension.
|
41
|
+
#
|
42
|
+
#If the barcode is 2D, it returns an array of strings representing
|
43
|
+
#each line in the barcode
|
33
44
|
def encoding
|
34
45
|
raise NotImplementedError, 'Every barcode should implement this method'
|
35
46
|
end
|
@@ -91,9 +102,8 @@ module Barby
|
|
91
102
|
class Barcode1D < Barcode
|
92
103
|
end
|
93
104
|
|
94
|
-
#
|
95
|
-
#
|
96
|
-
#with two dimensions.
|
105
|
+
#2D barcodes are 1D barcodes stacked on top of each other.
|
106
|
+
#Their encoding method must return an array of strings
|
97
107
|
class Barcode2D < Barcode
|
98
108
|
end
|
99
109
|
|
@@ -15,24 +15,22 @@ module Barby
|
|
15
15
|
3 => [53, 42, 32, 24], 4 => [78, 62, 46, 34],
|
16
16
|
5 => [106, 84, 60, 44], 6 => [134, 106, 74, 58],
|
17
17
|
7 => [154, 122, 86, 64], 8 => [192, 152, 108, 84],
|
18
|
-
9 => [230, 180, 130, 98], 10 => [271, 213, 151, 119]
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
# 37 => [2563, 1989, 1423, 1093], 38 => [2699, 2099, 1499, 1139],
|
35
|
-
# 39 => [2809, 2213, 1579, 1219], 40 => [2953, 2331, 1663, 1273]
|
18
|
+
9 => [230, 180, 130, 98], 10 => [271, 213, 151, 119],
|
19
|
+
11 => [321, 251, 177, 137], 12 => [367, 287, 203, 155],
|
20
|
+
13 => [425, 331, 241, 177], 14 => [458, 362, 258, 194],
|
21
|
+
15 => [520, 412, 292, 220], 16 => [586, 450, 322, 250],
|
22
|
+
17 => [644, 504, 364, 280], 18 => [718, 560, 394, 310],
|
23
|
+
19 => [792, 624, 442, 338], 20 => [858, 666, 482, 382],
|
24
|
+
21 => [929, 711, 509, 403], 22 => [1003, 779, 565, 439],
|
25
|
+
23 => [1091, 857, 611, 461], 24 => [1171, 911, 661, 511],
|
26
|
+
25 => [1273, 997, 715, 535], 26 => [1367, 1059, 751, 593],
|
27
|
+
27 => [1465, 1125, 805, 625], 28 => [1528, 1190, 868, 658],
|
28
|
+
29 => [1628, 1264, 908, 698], 30 => [1732, 1370, 982, 742],
|
29
|
+
31 => [1840, 1452, 1030, 790], 32 => [1952, 1538, 1112, 842],
|
30
|
+
33 => [2068, 1628, 1168, 898], 34 => [2188, 1722, 1228, 958],
|
31
|
+
35 => [2303, 1809, 1283, 983], 36 => [2431, 1911, 1351, 1051],
|
32
|
+
37 => [2563, 1989, 1423, 1093], 38 => [2699, 2099, 1499, 1139],
|
33
|
+
39 => [2809, 2213, 1579, 1219], 40 => [2953, 2331, 1663, 1273]
|
36
34
|
}.sort
|
37
35
|
|
38
36
|
LEVELS = { :l => 0, :m => 1, :q => 2, :h => 3 }
|
data/lib/barby/version.rb
CHANGED
data/vendor/rqrcode/CHANGELOG
CHANGED
data/vendor/rqrcode/Rakefile
CHANGED
@@ -19,7 +19,7 @@ module RQRCode #:nodoc:
|
|
19
19
|
@data_count = data_count
|
20
20
|
end
|
21
21
|
|
22
|
-
|
22
|
+
RQRCode::QRRSBlock::RS_BLOCK_TABLE = [
|
23
23
|
|
24
24
|
# L
|
25
25
|
# M
|
@@ -44,7 +44,7 @@ module RQRCode #:nodoc:
|
|
44
44
|
[2, 35, 17],
|
45
45
|
[2, 35, 13],
|
46
46
|
|
47
|
-
# 4
|
47
|
+
# 4
|
48
48
|
[1, 100, 80],
|
49
49
|
[2, 50, 32],
|
50
50
|
[2, 50, 24],
|
@@ -62,7 +62,7 @@ module RQRCode #:nodoc:
|
|
62
62
|
[4, 43, 19],
|
63
63
|
[4, 43, 15],
|
64
64
|
|
65
|
-
# 7
|
65
|
+
# 7
|
66
66
|
[2, 98, 78],
|
67
67
|
[4, 49, 31],
|
68
68
|
[2, 32, 14, 4, 33, 15],
|
@@ -80,14 +80,193 @@ module RQRCode #:nodoc:
|
|
80
80
|
[4, 36, 16, 4, 37, 17],
|
81
81
|
[4, 36, 12, 4, 37, 13],
|
82
82
|
|
83
|
-
# 10
|
83
|
+
# 10
|
84
84
|
[2, 86, 68, 2, 87, 69],
|
85
85
|
[4, 69, 43, 1, 70, 44],
|
86
86
|
[6, 43, 19, 2, 44, 20],
|
87
|
-
[6, 43, 15, 2, 44, 16]
|
87
|
+
[6, 43, 15, 2, 44, 16],
|
88
88
|
|
89
|
-
|
89
|
+
# 11
|
90
|
+
[4, 101, 81],
|
91
|
+
[1, 80, 50, 4, 81, 51],
|
92
|
+
[4, 50, 22, 4, 51, 23],
|
93
|
+
[3, 36, 12, 8, 37, 13],
|
94
|
+
|
95
|
+
# 12
|
96
|
+
[2, 116, 92, 2, 117, 93],
|
97
|
+
[6, 58, 36, 2, 59, 37],
|
98
|
+
[4, 46, 20, 6, 47, 21],
|
99
|
+
[7, 42, 14, 4, 43, 15],
|
100
|
+
|
101
|
+
# 13
|
102
|
+
[4, 133, 107],
|
103
|
+
[8, 59, 37, 1, 60, 38],
|
104
|
+
[8, 44, 20, 4, 45, 21],
|
105
|
+
[12, 33, 11, 4, 34, 12],
|
106
|
+
|
107
|
+
# 14
|
108
|
+
[3, 145, 115, 1, 146, 116],
|
109
|
+
[4, 64, 40, 5, 65, 41],
|
110
|
+
[11, 36, 16, 5, 37, 17],
|
111
|
+
[11, 36, 12, 5, 37, 13],
|
112
|
+
|
113
|
+
# 15
|
114
|
+
[5, 109, 87, 1, 110, 88],
|
115
|
+
[5, 65, 41, 5, 66, 42],
|
116
|
+
[5, 54, 24, 7, 55, 25],
|
117
|
+
[11, 36, 12],
|
118
|
+
|
119
|
+
# 16
|
120
|
+
[5, 122, 98, 1, 123, 99],
|
121
|
+
[7, 73, 45, 3, 74, 46],
|
122
|
+
[15, 43, 19, 2, 44, 20],
|
123
|
+
[3, 45, 15, 13, 46, 16],
|
124
|
+
|
125
|
+
# 17
|
126
|
+
[1, 135, 107, 5, 136, 108],
|
127
|
+
[10, 74, 46, 1, 75, 47],
|
128
|
+
[1, 50, 22, 15, 51, 23],
|
129
|
+
[2, 42, 14, 17, 43, 15],
|
130
|
+
|
131
|
+
# 18
|
132
|
+
[5, 150, 120, 1, 151, 121],
|
133
|
+
[9, 69, 43, 4, 70, 44],
|
134
|
+
[17, 50, 22, 1, 51, 23],
|
135
|
+
[2, 42, 14, 19, 43, 15],
|
136
|
+
|
137
|
+
# 19
|
138
|
+
[3, 141, 113, 4, 142, 114],
|
139
|
+
[3, 70, 44, 11, 71, 45],
|
140
|
+
[17, 47, 21, 4, 48, 22],
|
141
|
+
[9, 39, 13, 16, 40, 14],
|
142
|
+
|
143
|
+
# 20
|
144
|
+
[3, 135, 107, 5, 136, 108],
|
145
|
+
[3, 67, 41, 13, 68, 42],
|
146
|
+
[15, 54, 24, 5, 55, 25],
|
147
|
+
[15, 43, 15, 10, 44, 16],
|
148
|
+
|
149
|
+
# 21
|
150
|
+
[4, 144, 116, 4, 145, 117],
|
151
|
+
[17, 68, 42],
|
152
|
+
[17, 50, 22, 6, 51, 23],
|
153
|
+
[19, 46, 16, 6, 47, 17],
|
154
|
+
|
155
|
+
# 22
|
156
|
+
[2, 139, 111, 7, 140, 112],
|
157
|
+
[17, 74, 46],
|
158
|
+
[7, 54, 24, 16, 55, 25],
|
159
|
+
[34, 37, 13],
|
160
|
+
|
161
|
+
# 23
|
162
|
+
[4, 151, 121, 5, 152, 122],
|
163
|
+
[4, 75, 47, 14, 76, 48],
|
164
|
+
[11, 54, 24, 14, 55, 25],
|
165
|
+
[16, 45, 15, 14, 46, 16],
|
166
|
+
|
167
|
+
# 24
|
168
|
+
[6, 147, 117, 4, 148, 118],
|
169
|
+
[6, 73, 45, 14, 74, 46],
|
170
|
+
[11, 54, 24, 16, 55, 25],
|
171
|
+
[30, 46, 16, 2, 47, 17],
|
172
|
+
|
173
|
+
# 25
|
174
|
+
[8, 132, 106, 4, 133, 107],
|
175
|
+
[8, 75, 47, 13, 76, 48],
|
176
|
+
[7, 54, 24, 22, 55, 25],
|
177
|
+
[22, 45, 15, 13, 46, 16],
|
178
|
+
|
179
|
+
# 26
|
180
|
+
[10, 142, 114, 2, 143, 115],
|
181
|
+
[19, 74, 46, 4, 75, 47],
|
182
|
+
[28, 50, 22, 6, 51, 23],
|
183
|
+
[33, 46, 16, 4, 47, 17],
|
90
184
|
|
185
|
+
# 27
|
186
|
+
[8, 152, 122, 4, 153, 123],
|
187
|
+
[22, 73, 45, 3, 74, 46],
|
188
|
+
[8, 53, 23, 26, 54, 24],
|
189
|
+
[12, 45, 15, 28, 46, 16],
|
190
|
+
|
191
|
+
# 28
|
192
|
+
[3, 147, 117, 10, 148, 118],
|
193
|
+
[3, 73, 45, 23, 74, 46],
|
194
|
+
[4, 54, 24, 31, 55, 25],
|
195
|
+
[11, 45, 15, 31, 46, 16],
|
196
|
+
|
197
|
+
# 29
|
198
|
+
[7, 146, 116, 7, 147, 117],
|
199
|
+
[21, 73, 45, 7, 74, 46],
|
200
|
+
[1, 53, 23, 37, 54, 24],
|
201
|
+
[19, 45, 15, 26, 46, 16],
|
202
|
+
|
203
|
+
# 30
|
204
|
+
[5, 145, 115, 10, 146, 116],
|
205
|
+
[19, 75, 47, 10, 76, 48],
|
206
|
+
[15, 54, 24, 25, 55, 25],
|
207
|
+
[23, 45, 15, 25, 46, 16],
|
208
|
+
|
209
|
+
# 31
|
210
|
+
[13, 145, 115, 3, 146, 116],
|
211
|
+
[2, 74, 46, 29, 75, 47],
|
212
|
+
[42, 54, 24, 1, 55, 25],
|
213
|
+
[23, 45, 15, 28, 46, 16],
|
214
|
+
|
215
|
+
# 32
|
216
|
+
[17, 145, 115],
|
217
|
+
[10, 74, 46, 23, 75, 47],
|
218
|
+
[10, 54, 24, 35, 55, 25],
|
219
|
+
[19, 45, 15, 35, 46, 16],
|
220
|
+
|
221
|
+
# 33
|
222
|
+
[17, 145, 115, 1, 146, 116],
|
223
|
+
[14, 74, 46, 21, 75, 47],
|
224
|
+
[29, 54, 24, 19, 55, 25],
|
225
|
+
[11, 45, 15, 46, 46, 16],
|
226
|
+
|
227
|
+
# 34
|
228
|
+
[13, 145, 115, 6, 146, 116],
|
229
|
+
[14, 74, 46, 23, 75, 47],
|
230
|
+
[44, 54, 24, 7, 55, 25],
|
231
|
+
[59, 46, 16, 1, 47, 17],
|
232
|
+
|
233
|
+
# 35
|
234
|
+
[12, 151, 121, 7, 152, 122],
|
235
|
+
[12, 75, 47, 26, 76, 48],
|
236
|
+
[39, 54, 24, 14, 55, 25],
|
237
|
+
[22, 45, 15, 41, 46, 16],
|
238
|
+
|
239
|
+
# 36
|
240
|
+
[6, 151, 121, 14, 152, 122],
|
241
|
+
[6, 75, 47, 34, 76, 48],
|
242
|
+
[46, 54, 24, 10, 55, 25],
|
243
|
+
[2, 45, 15, 64, 46, 16],
|
244
|
+
|
245
|
+
# 37
|
246
|
+
[17, 152, 122, 4, 153, 123],
|
247
|
+
[29, 74, 46, 14, 75, 47],
|
248
|
+
[49, 54, 24, 10, 55, 25],
|
249
|
+
[24, 45, 15, 46, 46, 16],
|
250
|
+
|
251
|
+
# 38
|
252
|
+
[4, 152, 122, 18, 153, 123],
|
253
|
+
[13, 74, 46, 32, 75, 47],
|
254
|
+
[48, 54, 24, 14, 55, 25],
|
255
|
+
[42, 45, 15, 32, 46, 16],
|
256
|
+
|
257
|
+
# 39
|
258
|
+
[20, 147, 117, 4, 148, 118],
|
259
|
+
[40, 75, 47, 7, 76, 48],
|
260
|
+
[43, 54, 24, 22, 55, 25],
|
261
|
+
[10, 45, 15, 67, 46, 16],
|
262
|
+
|
263
|
+
# 40
|
264
|
+
[19, 148, 118, 6, 149, 119],
|
265
|
+
[18, 75, 47, 31, 76, 48],
|
266
|
+
[34, 54, 24, 34, 55, 25],
|
267
|
+
[20, 45, 15, 61, 46, 16]
|
268
|
+
|
269
|
+
]
|
91
270
|
|
92
271
|
def QRRSBlock.get_rs_blocks( type_no, error_correct_level )
|
93
272
|
rs_block = QRRSBlock.get_rs_block_table( type_no, error_correct_level )
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: barby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tore Darell
|
@@ -9,7 +9,7 @@ autorequire: barby
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-11-24 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
requirements: []
|
99
99
|
|
100
100
|
rubyforge_project: barby
|
101
|
-
rubygems_version: 1.
|
101
|
+
rubygems_version: 1.3.1
|
102
102
|
signing_key:
|
103
103
|
specification_version: 2
|
104
104
|
summary: A pure-Ruby barcode generator
|