ruby-zint 1.2.0 → 1.3.0

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.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +9 -0
  3. data/README.md +12 -4
  4. data/lib/zint/aus_post.rb +2 -2
  5. data/lib/zint/aus_redirect.rb +2 -2
  6. data/lib/zint/aus_reply.rb +2 -2
  7. data/lib/zint/aus_route.rb +2 -2
  8. data/lib/zint/azrune.rb +2 -2
  9. data/lib/zint/aztec.rb +2 -2
  10. data/lib/zint/barcode.rb +33 -75
  11. data/lib/zint/bc_412.rb +2 -2
  12. data/lib/zint/c25iata.rb +2 -2
  13. data/lib/zint/c25ind.rb +2 -2
  14. data/lib/zint/c25inter.rb +2 -2
  15. data/lib/zint/c25logic.rb +2 -2
  16. data/lib/zint/c25matrix.rb +2 -2
  17. data/lib/zint/c25standard.rb +2 -2
  18. data/lib/zint/cep_net.rb +2 -2
  19. data/lib/zint/channel.rb +2 -2
  20. data/lib/zint/codabar.rb +2 -2
  21. data/lib/zint/codablock_f.rb +2 -2
  22. data/lib/zint/code11.rb +2 -2
  23. data/lib/zint/code128.rb +2 -2
  24. data/lib/zint/code128ab.rb +2 -2
  25. data/lib/zint/code16k.rb +2 -2
  26. data/lib/zint/code32.rb +2 -2
  27. data/lib/zint/code39.rb +2 -2
  28. data/lib/zint/code49.rb +2 -2
  29. data/lib/zint/code93.rb +2 -2
  30. data/lib/zint/code_one.rb +2 -2
  31. data/lib/zint/daft.rb +2 -2
  32. data/lib/zint/data_matrix.rb +3 -3
  33. data/lib/zint/dbarexp.rb +2 -2
  34. data/lib/zint/dbarexpstk.rb +2 -2
  35. data/lib/zint/dbarltd.rb +2 -2
  36. data/lib/zint/dbaromn.rb +2 -2
  37. data/lib/zint/dbaromnstk.rb +2 -2
  38. data/lib/zint/dbarstk.rb +2 -2
  39. data/lib/zint/dependencies.rb +0 -1
  40. data/lib/zint/dot_code.rb +2 -2
  41. data/lib/zint/dpd.rb +2 -2
  42. data/lib/zint/dpident.rb +2 -2
  43. data/lib/zint/dpleit.rb +2 -2
  44. data/lib/zint/ean128.rb +2 -2
  45. data/lib/zint/ean14.rb +2 -2
  46. data/lib/zint/eanx.rb +2 -2
  47. data/lib/zint/eanxchk.rb +2 -2
  48. data/lib/zint/excode39.rb +2 -2
  49. data/lib/zint/fim.rb +2 -2
  50. data/lib/zint/flat.rb +2 -2
  51. data/lib/zint/grid_matrix.rb +2 -2
  52. data/lib/zint/gs1_128.rb +2 -2
  53. data/lib/zint/hanxin.rb +2 -2
  54. data/lib/zint/hibc128.rb +2 -2
  55. data/lib/zint/hibc39.rb +2 -2
  56. data/lib/zint/hibcaztec.rb +2 -2
  57. data/lib/zint/hibcblockf.rb +2 -2
  58. data/lib/zint/hibcdm.rb +2 -2
  59. data/lib/zint/hibcmicpdf.rb +2 -2
  60. data/lib/zint/hibcpdf.rb +2 -2
  61. data/lib/zint/hibcqr.rb +2 -2
  62. data/lib/zint/isbnx.rb +2 -2
  63. data/lib/zint/itf14.rb +2 -2
  64. data/lib/zint/japan_post.rb +2 -2
  65. data/lib/zint/kix.rb +2 -2
  66. data/lib/zint/korea_post.rb +2 -2
  67. data/lib/zint/logmars.rb +2 -2
  68. data/lib/zint/mailmark.rb +2 -2
  69. data/lib/zint/mailmark_2d.rb +2 -2
  70. data/lib/zint/mailmark_4s.rb +2 -2
  71. data/lib/zint/maxi_code.rb +2 -2
  72. data/lib/zint/micro_pdf417.rb +2 -2
  73. data/lib/zint/micro_qr.rb +2 -2
  74. data/lib/zint/msiplessey.rb +2 -2
  75. data/lib/zint/nve18.rb +2 -2
  76. data/lib/zint/one_code.rb +2 -2
  77. data/lib/zint/pdf417.rb +2 -2
  78. data/lib/zint/pdf417comp.rb +2 -2
  79. data/lib/zint/pdf417trunc.rb +2 -2
  80. data/lib/zint/pharma.rb +2 -2
  81. data/lib/zint/pharmatwo.rb +2 -2
  82. data/lib/zint/planet.rb +2 -2
  83. data/lib/zint/plessey.rb +2 -2
  84. data/lib/zint/postnet.rb +2 -2
  85. data/lib/zint/pzn.rb +2 -2
  86. data/lib/zint/qr.rb +2 -2
  87. data/lib/zint/rmqr.rb +2 -2
  88. data/lib/zint/rss14.rb +2 -2
  89. data/lib/zint/rss14stack.rb +2 -2
  90. data/lib/zint/rss14stackomni.rb +2 -2
  91. data/lib/zint/rssexp.rb +2 -2
  92. data/lib/zint/rssexpstack.rb +2 -2
  93. data/lib/zint/rssltd.rb +2 -2
  94. data/lib/zint/telepen.rb +2 -2
  95. data/lib/zint/telepennum.rb +2 -2
  96. data/lib/zint/ultra.rb +2 -2
  97. data/lib/zint/upc_a.rb +2 -2
  98. data/lib/zint/upc_a_chk.rb +2 -2
  99. data/lib/zint/upc_e.rb +2 -2
  100. data/lib/zint/upc_e_chk.rb +2 -2
  101. data/lib/zint/upnqr.rb +2 -2
  102. data/lib/zint/upu_s10.rb +2 -2
  103. data/lib/zint/uspsimail.rb +2 -2
  104. data/lib/zint/version.rb +1 -1
  105. data/lib/zint/vin.rb +2 -2
  106. metadata +120 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7cbe79d9fd528474b3cffe957b55cf8cb4aec0bdc97cca55314dc675e74f58c3
4
- data.tar.gz: a99a851ff4cfc42387d58e2d439c2ae01976fe03ad81595ccdc60cd94f0f5a89
3
+ metadata.gz: 486ea5eb1e9c5382337612a19ce2101cbbcba980dc30b9d1ff702f2dbc4beba9
4
+ data.tar.gz: 0be779d097b3e9f99d7c79d4f8da8895c2e8931ea6be84165f77d40bc9f0a5a8
5
5
  SHA512:
6
- metadata.gz: 75f8c14c3f4a3ad2f3990fa1c60204264f7120902e2ca31e2a51afc011c5e069d88bd3dcbeb0a8a73757163703c457c0ca49003da7470704afef01fb204585fe
7
- data.tar.gz: '0689e71889b46f0278886f717ad3966c2a1b215dd6502666637913112fc84abad23f5ae604d0a1b82bcf2c0379d77975bedaa43887d24d2dab6295734abf0b23'
6
+ metadata.gz: a33d8244d461e0dac91b66f086aa153d26ed188ae418fa3b1ba1d03139e424d678b2ef92a988f8db7c23d6e46627912e2f04a753c66e77b7c5b1b51e9383f3e5
7
+ data.tar.gz: c97890ca409f5393478f14b4630147229c8e4f282b640a51ff781d98fc8f4c31f42eaed3167d9e16d6b2dc021884af14fd92a75234f573bcbb46562db62d326d
data/.yardopts ADDED
@@ -0,0 +1,9 @@
1
+ --readme README.md
2
+ --title 'Ruby FFI binding for libzint'
3
+ --exclude '/ext.ruby-zint/'
4
+ --no-private
5
+ --charset utf-8
6
+ lib/**/*.rb
7
+ -
8
+ README.md
9
+ LICENSE.txt
data/README.md CHANGED
@@ -49,7 +49,7 @@ bundle config build.ruby-zint --enable-system-libzint
49
49
  ```ruby
50
50
  require "zint"
51
51
 
52
- barcode = Zint::Barcode.new(value: "Test", type: Zint::BARCODE_CODE128)
52
+ barcode = Zint::Barcode.new(value: "Test", symbology: Zint::BARCODE_CODE128)
53
53
 
54
54
  # Export to file
55
55
  barcode.to_file(path: "out.png")
@@ -71,8 +71,16 @@ end
71
71
  png.save("out.png")
72
72
 
73
73
  # Use vector export
74
- vector_struct = barcode.to_vector
75
- # See manual: https://zint.org.uk/manual/chapter/5#buffering-symbols-in-memory-vector
74
+ vec = Zint::Qr.new(value: "Test").to_vector
75
+ png = ChunkyPNG::Image.new(vec.width.to_i, vec.height.to_i, ChunkyPNG::Color::WHITE)
76
+ vec.each_rectangle do |rec|
77
+ png.rect(rec.x.to_i, rec.y.to_i,
78
+ rec.x.to_i+rec.width.to_i-1, rec.y.to_i+rec.height.to_i-1,
79
+ ChunkyPNG::Color::BLACK, ChunkyPNG::Color::BLACK)
80
+ end
81
+ png.save("out.png")
82
+
83
+ # See also manual: https://zint.org.uk/manual/chapter/5#buffering-symbols-in-memory-vector
76
84
 
77
85
  # Use file as input
78
86
  barcode = Zint::Barcode.new(input_file: "/tmp/test.txt")
@@ -99,4 +107,4 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/api-wa
99
107
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
100
108
 
101
109
  ## Credits
102
- The project is based on the work and ideas of Angel Pizarro's [zint](https://github.com/delagoya/zint).
110
+ The project is based on the work and ideas of Angel Pizarro's [zint](https://github.com/delagoya/zint). I would also like to say a big thank you to [Lars Kanis](https://github.com/larskanis) for his great contributions.
data/lib/zint/aus_post.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Zint
2
2
  # Australia Post 4-State Barcode
3
3
  class AusPost < Barcode
4
- def initialize(value: nil, input_file: nil, options: {})
5
- super(value: value, input_file: input_file, type: Zint::BARCODE_AUSPOST, options: options)
4
+ def initialize(value: nil, input_file: nil, **kwargs)
5
+ super(value: value, input_file: input_file, symbology: Zint::BARCODE_AUSPOST, **kwargs)
6
6
  end
7
7
  end
8
8
  end
@@ -1,8 +1,8 @@
1
1
  module Zint
2
2
  # Australia Post Redirection
3
3
  class AusRedirect < Barcode
4
- def initialize(value: nil, input_file: nil, options: {})
5
- super(value: value, input_file: input_file, type: Zint::BARCODE_AUSREDIRECT, options: options)
4
+ def initialize(value: nil, input_file: nil, **kwargs)
5
+ super(value: value, input_file: input_file, symbology: Zint::BARCODE_AUSREDIRECT, **kwargs)
6
6
  end
7
7
  end
8
8
  end
@@ -1,8 +1,8 @@
1
1
  module Zint
2
2
  # Australia Post Reply Paid
3
3
  class AusReply < Barcode
4
- def initialize(value: nil, input_file: nil, options: {})
5
- super(value: value, input_file: input_file, type: Zint::BARCODE_AUSREPLY, options: options)
4
+ def initialize(value: nil, input_file: nil, **kwargs)
5
+ super(value: value, input_file: input_file, symbology: Zint::BARCODE_AUSREPLY, **kwargs)
6
6
  end
7
7
  end
8
8
  end
@@ -1,8 +1,8 @@
1
1
  module Zint
2
2
  # Australia Post Routing
3
3
  class AusRoute < Barcode
4
- def initialize(value: nil, input_file: nil, options: {})
5
- super(value: value, input_file: input_file, type: Zint::BARCODE_AUSROUTE, options: options)
4
+ def initialize(value: nil, input_file: nil, **kwargs)
5
+ super(value: value, input_file: input_file, symbology: Zint::BARCODE_AUSROUTE, **kwargs)
6
6
  end
7
7
  end
8
8
  end
data/lib/zint/azrune.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Zint
2
2
  # Aztec Runes
3
3
  class Azrune < Barcode
4
- def initialize(value: nil, input_file: nil, options: {})
5
- super(value: value, input_file: input_file, type: Zint::BARCODE_AZRUNE, options: options)
4
+ def initialize(value: nil, input_file: nil, **kwargs)
5
+ super(value: value, input_file: input_file, symbology: Zint::BARCODE_AZRUNE, **kwargs)
6
6
  end
7
7
  end
8
8
  end
data/lib/zint/aztec.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Zint
2
2
  # Aztec Code
3
3
  class Aztec < Barcode
4
- def initialize(value: nil, input_file: nil, options: {})
5
- super(value: value, input_file: input_file, type: Zint::BARCODE_AZTEC, options: options)
4
+ def initialize(value: nil, input_file: nil, **kwargs)
5
+ super(value: value, input_file: input_file, symbology: Zint::BARCODE_AZTEC, **kwargs)
6
6
  end
7
7
  end
8
8
  end
data/lib/zint/barcode.rb CHANGED
@@ -2,11 +2,13 @@ module Zint
2
2
  # Base class to represent the barcode
3
3
  #
4
4
  # @example Create new barcode
5
- # barcode = Zint::Barcode.new(value: "Test", type: Zint::BARCODE_QRCODE, options: {option_1: 1})
5
+ # barcode = Zint::Barcode.new(value: "Test", symbology: Zint::BARCODE_QRCODE, option_1: 1)
6
6
  # barcode.to_file(path: "qr.png")
7
7
  class Barcode
8
8
  include Native
9
9
 
10
+ class AlreadyGenerated < Error; end
11
+
10
12
  # @return [String, NilClass] Content of the barcode
11
13
  attr_accessor :value
12
14
  # @return [String, NilClass] Path to input file with content of the barcode
@@ -14,15 +16,16 @@ module Zint
14
16
 
15
17
  # @param value [String, NilClass] Content of the barcode
16
18
  # @param input_file [String, NilClass] Path to input file with content of the barcode
17
- # @param type [Integer] Type of barcode
18
- # @param options [Hash] Specific options for Zint symbol
19
- def initialize(value: nil, input_file: nil, type: Zint::BARCODE_CODE128, options: {})
19
+ # @param symbology [Integer] Type of barcode
20
+ # @param kwargs [Hash] Specific options for zint symbol (height, scale, ...)
21
+ def initialize(value: nil, input_file: nil, symbology: Zint::BARCODE_CODE128, **kwargs)
20
22
  raise ArgumentError, "value or input_file must be given!" if value&.empty? && input_file&.empty?
21
23
  raise ArgumentError, "input_file not found!" if input_file && !File.exist?(input_file)
22
24
 
23
- @zint_symbol = create_symbol(type)
24
- options.each do |key, value|
25
- @zint_symbol[key] = value
25
+ @zint_symbol = Native.ZBarcode_Create
26
+ self.symbology = symbology
27
+ kwargs.each do |k, v|
28
+ send("#{k}=", v)
26
29
  end
27
30
 
28
31
  @value = value
@@ -36,6 +39,9 @@ module Zint
36
39
  # Must end in .png, .gif, .bmp, .emf, .eps, .pcx, .svg, .tif or .txt
37
40
  # @param rotate_angle [Integer] Rotate angle in degrees (0, 90, 180, 270)
38
41
  def to_file(path:, rotate_angle: 0)
42
+ unless outfile == 'out.png'
43
+ raise AlreadyGenerated, "to_file was already executed"
44
+ end
39
45
  @zint_symbol[:outfile] = path
40
46
 
41
47
  if input_file
@@ -69,6 +75,9 @@ module Zint
69
75
  # @param rotate_angle [Integer] Rotate angle in degrees (0, 90, 180, 270)
70
76
  # @return [String] Exported barcode buffer
71
77
  def to_buffer(rotate_angle: 0)
78
+ unless @zint_symbol[:bitmap].null?
79
+ raise AlreadyGenerated, "to_vector was already executed"
80
+ end
72
81
  @zint_symbol[:output_options] = Zint::OUT_BUFFER_INTERMEDIATE
73
82
 
74
83
  if input_file
@@ -102,6 +111,9 @@ module Zint
102
111
  # @param rotate_angle [Integer] Rotate angle in degrees (0, 90, 180, 270)
103
112
  # @return [Zint::Structs::Vector] Vector data of barcode
104
113
  def to_vector(rotate_angle: 0)
114
+ unless @zint_symbol[:vector].pointer.null?
115
+ raise AlreadyGenerated, "to_vector was already executed"
116
+ end
105
117
  if input_file
106
118
  call_function(:ZBarcode_Encode_File_and_Buffer_Vector, @zint_symbol, input_file, rotate_angle)
107
119
  else
@@ -115,6 +127,9 @@ module Zint
115
127
  end
116
128
 
117
129
  # Free barcode and all memory associated with it.
130
+ #
131
+ # Note: This method is dangerous insofar, that previously exported vectors (by #to_vector ) are no longer usable and any access to them will result in a segfault.
132
+ # It is better to not call this method and leave cleaning up to the garbage collector.
118
133
  def free
119
134
  @zint_symbol.pointer.free
120
135
  end
@@ -130,8 +145,6 @@ module Zint
130
145
  #
131
146
  # @param type [Integer] Type of barcode
132
147
  def symbology=(type)
133
- reset_symbol
134
-
135
148
  @zint_symbol[:symbology] = type
136
149
  end
137
150
 
@@ -144,8 +157,6 @@ module Zint
144
157
  #
145
158
  # @param height [Float] Height of barcode
146
159
  def height=(height)
147
- reset_symbol
148
-
149
160
  @zint_symbol[:height] = height
150
161
  end
151
162
 
@@ -158,8 +169,6 @@ module Zint
158
169
  #
159
170
  # @param scale [Float] Scale of barcode
160
171
  def scale=(scale)
161
- reset_symbol
162
-
163
172
  @zint_symbol[:scale] = scale
164
173
  end
165
174
 
@@ -170,10 +179,8 @@ module Zint
170
179
 
171
180
  # Sets width in X-dimensions of whitespace to left & right of barcode
172
181
  #
173
- # @param whitespace width [Integer] Whitespace width of barcode
182
+ # @param whitespace_width [Integer] Whitespace width of barcode
174
183
  def whitespace_width=(whitespace_width)
175
- reset_symbol
176
-
177
184
  @zint_symbol[:whitespace_width] = whitespace_width
178
185
  end
179
186
 
@@ -184,10 +191,8 @@ module Zint
184
191
 
185
192
  # Sets height in X-dimensions of whitespace above & below the barcode
186
193
  #
187
- # @param whitespace height [Integer] Whitespace height of barcode
194
+ # @param whitespace_height [Integer] Whitespace height of barcode
188
195
  def whitespace_height=(whitespace_height)
189
- reset_symbol
190
-
191
196
  @zint_symbol[:whitespace_height] = whitespace_height
192
197
  end
193
198
 
@@ -198,10 +203,8 @@ module Zint
198
203
 
199
204
  # Sets size of border in X-dimensions
200
205
  #
201
- # @param border width [Integer] Border width of barcode
206
+ # @param border_width [Integer] Border width of barcode
202
207
  def border_width=(border_width)
203
- reset_symbol
204
-
205
208
  @zint_symbol[:border_width] = border_width
206
209
  end
207
210
 
@@ -212,10 +215,8 @@ module Zint
212
215
 
213
216
  # Set various output parameters (bind, box etc, see below) of barcode
214
217
  #
215
- # @param output options [Integer] Output options of barcode
218
+ # @param output_options [Integer] Output options of barcode
216
219
  def output_options=(output_options)
217
- reset_symbol
218
-
219
220
  @zint_symbol[:output_options] = output_options
220
221
  end
221
222
 
@@ -228,8 +229,6 @@ module Zint
228
229
  #
229
230
  # @param fgcolour [String] Foreground colour of barcode
230
231
  def fgcolour=(fgcolour)
231
- reset_symbol
232
-
233
232
  @zint_symbol[:fgcolour] = fgcolour
234
233
  end
235
234
 
@@ -242,8 +241,6 @@ module Zint
242
241
  #
243
242
  # @param bgcolour [String] Background color of barcode
244
243
  def bgcolour=(bgcolour)
245
- reset_symbol
246
-
247
244
  @zint_symbol[:bgcolour] = bgcolour
248
245
  end
249
246
 
@@ -263,8 +260,6 @@ module Zint
263
260
  #
264
261
  # @param option_1 [Integer] Option 1 of barcode
265
262
  def option_1=(option_1)
266
- reset_symbol
267
-
268
263
  @zint_symbol[:option_1] = option_1
269
264
  end
270
265
 
@@ -275,10 +270,8 @@ module Zint
275
270
 
276
271
  # Sets option 2 (symbol-specific options) of barcode
277
272
  #
278
- # @param option 2 [Integer] Option 2 of barcode
273
+ # @param option_2 [Integer] Option 2 of barcode
279
274
  def option_2=(option_2)
280
- reset_symbol
281
-
282
275
  @zint_symbol[:option_2] = option_2
283
276
  end
284
277
 
@@ -289,10 +282,8 @@ module Zint
289
282
 
290
283
  # Sets option 3 (symbol-specific options) of barcode
291
284
  #
292
- # @param option 3 [Integer] Option 3 of barcode
285
+ # @param option_3 [Integer] Option 3 of barcode
293
286
  def option_3=(option_3)
294
- reset_symbol
295
-
296
287
  @zint_symbol[:option_3] = option_3
297
288
  end
298
289
 
@@ -306,8 +297,6 @@ module Zint
306
297
  #
307
298
  # @param show_hrt [Integer] show_hrt of barcode
308
299
  def show_hrt=(show_hrt)
309
- reset_symbol
310
-
311
300
  @zint_symbol[:show_hrt] = show_hrt
312
301
  end
313
302
 
@@ -318,10 +307,8 @@ module Zint
318
307
 
319
308
  # Sets font size of barcode (Unused)
320
309
  #
321
- # @param font size [Integer] Font size of barcode
310
+ # @param fontsize [Integer] Font size of barcode
322
311
  def fontsize=(fontsize)
323
- reset_symbol
324
-
325
312
  @zint_symbol[:fontsize] = fontsize
326
313
  end
327
314
 
@@ -334,8 +321,6 @@ module Zint
334
321
  #
335
322
  # @param input_mode [Integer] Input mode of barcode
336
323
  def input_mode=(input_mode)
337
- reset_symbol
338
-
339
324
  @zint_symbol[:input_mode] = input_mode
340
325
  end
341
326
 
@@ -348,8 +333,6 @@ module Zint
348
333
  #
349
334
  # @param eci [Integer] ECI of barcode
350
335
  def eci=(eci)
351
- reset_symbol
352
-
353
336
  @zint_symbol[:eci] = eci
354
337
  end
355
338
 
@@ -360,10 +343,8 @@ module Zint
360
343
 
361
344
  # Sets resolution of output in dots per mm (BMP/EMF/PCX/PNG/TIF only). Default 0 (none)
362
345
  #
363
- # @param text [Float] Text of barcode
346
+ # @param dpmm [Float] Resolution of output in dots per mm
364
347
  def dpmm=(dpmm)
365
- reset_symbol
366
-
367
348
  @zint_symbol[:dpmm] = dpmm
368
349
  end
369
350
 
@@ -374,10 +355,8 @@ module Zint
374
355
 
375
356
  # Sets height in X-dimensions that EAN/UPC guard bars descend. Default 5
376
357
  #
377
- # @param text [Float] Text of barcode
358
+ # @param guard_descent [Float] Height in X-dimensions that EAN/UPC guard bars descend
378
359
  def guard_descent=(guard_descent)
379
- reset_symbol
380
-
381
360
  @zint_symbol[:guard_descent] = guard_descent
382
361
  end
383
362
 
@@ -388,10 +367,8 @@ module Zint
388
367
 
389
368
  # Sets structured append info. Default structapp.count 0 (none)
390
369
  #
391
- # @param text [Structs::Structapp] Text of barcode
370
+ # @param structapp [Structs::Structapp] Structured append info
392
371
  def structapp=(structapp)
393
- reset_symbol
394
-
395
372
  @zint_symbol[:structapp] = structapp
396
373
  end
397
374
 
@@ -404,8 +381,6 @@ module Zint
404
381
  #
405
382
  # @param text [String] Text of barcode
406
383
  def text=(text)
407
- reset_symbol
408
-
409
384
  @zint_symbol[:text] = text
410
385
  end
411
386
 
@@ -428,8 +403,6 @@ module Zint
428
403
  #
429
404
  # @param primary [String] Primary of barcode
430
405
  def primary=(primary)
431
- reset_symbol
432
-
433
406
  @zint_symbol[:primary] = primary
434
407
  end
435
408
 
@@ -442,8 +415,6 @@ module Zint
442
415
  #
443
416
  # @param encoded_data [String] Encoded data of barcode
444
417
  def encoded_data=(encoded_data)
445
- reset_symbol
446
-
447
418
  @zint_symbol[:encoded_data] = encoded_data
448
419
  end
449
420
 
@@ -479,10 +450,8 @@ module Zint
479
450
 
480
451
  # Sets size of dots used in BARCODE_DOTTY_MODE
481
452
  #
482
- # @param dot size [Float] Dot size of barcode
453
+ # @param dot_size [Float] Dot size of barcode
483
454
  def dot_size=(dot_size)
484
- reset_symbol
485
-
486
455
  @zint_symbol[:dot_size] = dot_size
487
456
  end
488
457
 
@@ -495,8 +464,6 @@ module Zint
495
464
  #
496
465
  # @param debug [Integer] Debug level of barcode
497
466
  def debug=(debug)
498
- reset_symbol
499
-
500
467
  @zint_symbol[:debug] = debug
501
468
  end
502
469
 
@@ -509,8 +476,6 @@ module Zint
509
476
  #
510
477
  # @param warn_level [Integer] Warn level of barcode
511
478
  def warn_level=(warn_level)
512
- reset_symbol
513
-
514
479
  @zint_symbol[:warn_level] = warn_level
515
480
  end
516
481
 
@@ -529,12 +494,5 @@ module Zint
529
494
 
530
495
  error_code
531
496
  end
532
-
533
- def create_symbol(type)
534
- symbol = Native.ZBarcode_Create
535
- symbol[:symbology] = type
536
-
537
- symbol
538
- end
539
497
  end
540
498
  end
data/lib/zint/bc_412.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Zint
2
2
  # IBM BC412 (SEMI T1-95)
3
3
  class Bc412 < Barcode
4
- def initialize(value: nil, input_file: nil, options: {})
5
- super(value: value, input_file: input_file, type: Zint::BARCODE_BC412, options: options)
4
+ def initialize(value: nil, input_file: nil, **kwargs)
5
+ super(value: value, input_file: input_file, symbology: Zint::BARCODE_BC412, **kwargs)
6
6
  end
7
7
  end
8
8
  end
data/lib/zint/c25iata.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Zint
2
2
  # 2 of 5 IATA
3
3
  class C25iata < Barcode
4
- def initialize(value: nil, input_file: nil, options: {})
5
- super(value: value, input_file: input_file, type: Zint::BARCODE_C25IATA, options: options)
4
+ def initialize(value: nil, input_file: nil, **kwargs)
5
+ super(value: value, input_file: input_file, symbology: Zint::BARCODE_C25IATA, **kwargs)
6
6
  end
7
7
  end
8
8
  end
data/lib/zint/c25ind.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Zint
2
2
  # 2 of 5 Industrial
3
3
  class C25ind < Barcode
4
- def initialize(value: nil, input_file: nil, options: {})
5
- super(value: value, input_file: input_file, type: Zint::BARCODE_C25IND, options: options)
4
+ def initialize(value: nil, input_file: nil, **kwargs)
5
+ super(value: value, input_file: input_file, symbology: Zint::BARCODE_C25IND, **kwargs)
6
6
  end
7
7
  end
8
8
  end
data/lib/zint/c25inter.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Zint
2
2
  # 2 of 5 Interleaved
3
3
  class C25inter < Barcode
4
- def initialize(value: nil, input_file: nil, options: {})
5
- super(value: value, input_file: input_file, type: Zint::BARCODE_C25INTER, options: options)
4
+ def initialize(value: nil, input_file: nil, **kwargs)
5
+ super(value: value, input_file: input_file, symbology: Zint::BARCODE_C25INTER, **kwargs)
6
6
  end
7
7
  end
8
8
  end
data/lib/zint/c25logic.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Zint
2
2
  # 2 of 5 Data Logic
3
3
  class C25logic < Barcode
4
- def initialize(value: nil, input_file: nil, options: {})
5
- super(value: value, input_file: input_file, type: Zint::BARCODE_C25LOGIC, options: options)
4
+ def initialize(value: nil, input_file: nil, **kwargs)
5
+ super(value: value, input_file: input_file, symbology: Zint::BARCODE_C25LOGIC, **kwargs)
6
6
  end
7
7
  end
8
8
  end
@@ -1,8 +1,8 @@
1
1
  module Zint
2
2
  # Legacy
3
3
  class C25matrix < Barcode
4
- def initialize(value: nil, input_file: nil, options: {})
5
- super(value: value, input_file: input_file, type: Zint::BARCODE_C25MATRIX, options: options)
4
+ def initialize(value: nil, input_file: nil, **kwargs)
5
+ super(value: value, input_file: input_file, symbology: Zint::BARCODE_C25MATRIX, **kwargs)
6
6
  end
7
7
  end
8
8
  end
@@ -1,8 +1,8 @@
1
1
  module Zint
2
2
  # 2 of 5 Standard (Matrix)
3
3
  class C25standard < Barcode
4
- def initialize(value: nil, input_file: nil, options: {})
5
- super(value: value, input_file: input_file, type: Zint::BARCODE_C25STANDARD, options: options)
4
+ def initialize(value: nil, input_file: nil, **kwargs)
5
+ super(value: value, input_file: input_file, symbology: Zint::BARCODE_C25STANDARD, **kwargs)
6
6
  end
7
7
  end
8
8
  end
data/lib/zint/cep_net.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Zint
2
2
  # Brazilian CEPNet Postal Code
3
3
  class CepNet < Barcode
4
- def initialize(value: nil, input_file: nil, options: {})
5
- super(value: value, input_file: input_file, type: Zint::BARCODE_CEPNET, options: options)
4
+ def initialize(value: nil, input_file: nil, **kwargs)
5
+ super(value: value, input_file: input_file, symbology: Zint::BARCODE_CEPNET, **kwargs)
6
6
  end
7
7
  end
8
8
  end
data/lib/zint/channel.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Zint
2
2
  # Channel Code
3
3
  class Channel < Barcode
4
- def initialize(value: nil, input_file: nil, options: {})
5
- super(value: value, input_file: input_file, type: Zint::BARCODE_CHANNEL, options: options)
4
+ def initialize(value: nil, input_file: nil, **kwargs)
5
+ super(value: value, input_file: input_file, symbology: Zint::BARCODE_CHANNEL, **kwargs)
6
6
  end
7
7
  end
8
8
  end
data/lib/zint/codabar.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Zint
2
2
  # Codabar
3
3
  class Codabar < Barcode
4
- def initialize(value: nil, input_file: nil, options: {})
5
- super(value: value, input_file: input_file, type: Zint::BARCODE_CODABAR, options: options)
4
+ def initialize(value: nil, input_file: nil, **kwargs)
5
+ super(value: value, input_file: input_file, symbology: Zint::BARCODE_CODABAR, **kwargs)
6
6
  end
7
7
  end
8
8
  end
@@ -1,8 +1,8 @@
1
1
  module Zint
2
2
  # Codablock-F
3
3
  class CodablockF < Barcode
4
- def initialize(value: nil, input_file: nil, options: {})
5
- super(value: value, input_file: input_file, type: Zint::BARCODE_CODABLOCKF, options: options)
4
+ def initialize(value: nil, input_file: nil, **kwargs)
5
+ super(value: value, input_file: input_file, symbology: Zint::BARCODE_CODABLOCKF, **kwargs)
6
6
  end
7
7
  end
8
8
  end
data/lib/zint/code11.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Zint
2
2
  # Code 11
3
3
  class Code11 < Barcode
4
- def initialize(value: nil, input_file: nil, options: {})
5
- super(value: value, input_file: input_file, type: Zint::BARCODE_CODE11, options: options)
4
+ def initialize(value: nil, input_file: nil, **kwargs)
5
+ super(value: value, input_file: input_file, symbology: Zint::BARCODE_CODE11, **kwargs)
6
6
  end
7
7
  end
8
8
  end
data/lib/zint/code128.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Zint
2
2
  # Code 128
3
3
  class Code128 < Barcode
4
- def initialize(value: nil, input_file: nil, options: {})
5
- super(value: value, input_file: input_file, type: Zint::BARCODE_CODE128, options: options)
4
+ def initialize(value: nil, input_file: nil, **kwargs)
5
+ super(value: value, input_file: input_file, symbology: Zint::BARCODE_CODE128, **kwargs)
6
6
  end
7
7
  end
8
8
  end
@@ -1,8 +1,8 @@
1
1
  module Zint
2
2
  # Code 128 (Suppress Code Set C)
3
3
  class Code128AB < Barcode
4
- def initialize(value: nil, input_file: nil, options: {})
5
- super(value: value, input_file: input_file, type: Zint::BARCODE_CODE128AB, options: options)
4
+ def initialize(value: nil, input_file: nil, **kwargs)
5
+ super(value: value, input_file: input_file, symbology: Zint::BARCODE_CODE128AB, **kwargs)
6
6
  end
7
7
  end
8
8
  end
data/lib/zint/code16k.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Zint
2
2
  # Code 16k
3
3
  class Code16k < Barcode
4
- def initialize(value: nil, input_file: nil, options: {})
5
- super(value: value, input_file: input_file, type: Zint::BARCODE_CODE16K, options: options)
4
+ def initialize(value: nil, input_file: nil, **kwargs)
5
+ super(value: value, input_file: input_file, symbology: Zint::BARCODE_CODE16K, **kwargs)
6
6
  end
7
7
  end
8
8
  end
data/lib/zint/code32.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Zint
2
2
  # Code 32
3
3
  class Code32 < Barcode
4
- def initialize(value: nil, input_file: nil, options: {})
5
- super(value: value, input_file: input_file, type: Zint::BARCODE_CODE32, options: options)
4
+ def initialize(value: nil, input_file: nil, **kwargs)
5
+ super(value: value, input_file: input_file, symbology: Zint::BARCODE_CODE32, **kwargs)
6
6
  end
7
7
  end
8
8
  end
data/lib/zint/code39.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Zint
2
2
  # Code 39
3
3
  class Code39 < Barcode
4
- def initialize(value: nil, input_file: nil, options: {})
5
- super(value: value, input_file: input_file, type: Zint::BARCODE_CODE39, options: options)
4
+ def initialize(value: nil, input_file: nil, **kwargs)
5
+ super(value: value, input_file: input_file, symbology: Zint::BARCODE_CODE39, **kwargs)
6
6
  end
7
7
  end
8
8
  end