barcodes 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 944fbde8a1a2ade19446e0c71b396781777a79a896f57789b3c9ad3699aaf3c3
4
+ data.tar.gz: 9652cb78cd909b82e67f6d7553df89d1041c5ab398e1625f026dfa3ce953621b
5
+ SHA512:
6
+ metadata.gz: c89ecc9e1dae755dc480dfe0dc9c17f3012ccb7ea9780913264ef1229eb13e84c92fe90ccf7cad9e5704ede06ec22403e92c254fcb62036b068d16152d3d522a
7
+ data.tar.gz: 03b544d1506e7caa5e3b0269ea7a5966ec96570d775ea290717e3df08cec27a69fc80c5edf44f1ced57a414f1842886f5e9979390ebdbd60e0523270ca6a2af4
@@ -18,6 +18,7 @@ module Barcodes
18
18
 
19
19
  ilist = Magick::ImageList.new
20
20
  ilist.from_blob(pdf.render)
21
+ ilist.format="PNG"
21
22
 
22
23
  unless filename.nil?
23
24
  ilist.each_with_index do |image, index|
@@ -29,4 +30,4 @@ module Barcodes
29
30
  end
30
31
  end
31
32
  end
32
- end
33
+ end
@@ -8,18 +8,18 @@ require 'barcodes/symbology/base'
8
8
 
9
9
  module Barcodes
10
10
  module Symbology
11
-
11
+
12
12
  # This is the base class for all EAN type (EAN8, EAN13, UPC-A) barcode symbologies.
13
13
  # EAN type barcodes can encode only the numbers 0-9
14
- #
14
+ #
15
15
  # More info: http://en.wikipedia.org/wiki/European_Article_Number
16
16
  class Ean < Base
17
-
17
+
18
18
  # EAN character set
19
19
  def self.charset
20
20
  ['0','1','2','3','4','5','6','7','8','9','S','C'].collect {|c| c.bytes.to_a[0] }
21
21
  end
22
-
22
+
23
23
  # EAN parity values table
24
24
  def self.parity
25
25
  [
@@ -28,7 +28,7 @@ module Barcodes
28
28
  "010110", "011010"
29
29
  ]
30
30
  end
31
-
31
+
32
32
  # EAN left hand even values table
33
33
  def self.left_hand_even
34
34
  [
@@ -37,7 +37,7 @@ module Barcodes
37
37
  "0110111", "0001011"
38
38
  ]
39
39
  end
40
-
40
+
41
41
  # EAN left hand odd values table
42
42
  def self.left_hand_odd
43
43
  [
@@ -46,7 +46,7 @@ module Barcodes
46
46
  "0001001", "0010111"
47
47
  ]
48
48
  end
49
-
49
+
50
50
  # EAN right hand values table
51
51
  def self.right_hand
52
52
  [
@@ -55,26 +55,26 @@ module Barcodes
55
55
  "1001000", "1110100"
56
56
  ]
57
57
  end
58
-
58
+
59
59
  # EAN uses special value sets so this returns an empty array
60
60
  def self.valueset
61
61
  []
62
62
  end
63
-
63
+
64
64
  # Creates a new EAN instance
65
65
  def initialize(args={})
66
66
  super(args)
67
-
67
+
68
68
  @start_character = 'S'
69
69
  @stop_character = 'S'
70
70
  @center_character = 'C'
71
71
  end
72
-
72
+
73
73
  # Returns data + checksum
74
74
  def caption_data
75
75
  @data + self.checksum
76
76
  end
77
-
77
+
78
78
  # Encodes data into 1's and 0's
79
79
  def encoded_data
80
80
  if self.valid?
@@ -103,12 +103,12 @@ module Barcodes
103
103
  encoded_data
104
104
  end
105
105
  end
106
-
106
+
107
107
  # EAN uses quiet zone that is 9 times the bar width in mils
108
108
  def quiet_zone_width
109
109
  self.bar_width * 9
110
110
  end
111
-
111
+
112
112
  # Calculates the checksum
113
113
  def checksum
114
114
  if self.valid?
@@ -124,15 +124,19 @@ module Barcodes
124
124
  end
125
125
  index += 1
126
126
  end
127
-
127
+
128
128
  value = 10 - (sum % 10)
129
-
129
+
130
+ if value == 10
131
+ value = 0
132
+ end
133
+
130
134
  return value.to_s
131
135
  end
132
136
  end
133
-
137
+
134
138
  protected
135
-
139
+
136
140
  # Encodes a single given character (as ASCII integer) using the given parity (1,0)
137
141
  def _encode_character_with_parity(character, parity)
138
142
  if self.class.charset.include? character
@@ -145,7 +149,7 @@ module Barcodes
145
149
  return nil
146
150
  end
147
151
  end
148
-
152
+
149
153
  # Encodes a single given character (as ASCII integer) using right hand values table
150
154
  def _encode_character_with_right_hand(character)
151
155
  if self.class.charset.include? character
@@ -154,11 +158,11 @@ module Barcodes
154
158
  return nil
155
159
  end
156
160
  end
157
-
161
+
158
162
  # Returns nil
159
163
  def _encode_character(character)
160
164
  nil
161
165
  end
162
166
  end
163
167
  end
164
- end
168
+ end
@@ -4,8 +4,8 @@
4
4
  # Copyright:: Copyright (c) 2012 Infinite Token LLC
5
5
  # License:: MIT License
6
6
 
7
- #
7
+ #
8
8
  module Barcodes
9
9
  # Returns the current version
10
- VERSION = "0.0.11"
10
+ VERSION = "0.0.12"
11
11
  end
metadata CHANGED
@@ -1,78 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: barcodes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
5
- prerelease:
4
+ version: 0.0.12
6
5
  platform: ruby
7
6
  authors:
8
7
  - Aaron Wright
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-29 00:00:00.000000000 Z
11
+ date: 2018-12-25 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rspec
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: prawn
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rmagick
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  description: Barcodes is a RubyGem for creating and rendering common barcode symbologies.
@@ -83,9 +74,8 @@ executables:
83
74
  extensions: []
84
75
  extra_rdoc_files: []
85
76
  files:
86
- - .gitignore
87
- - .rspec
88
- - .rvmrc
77
+ - ".gitignore"
78
+ - ".rspec"
89
79
  - Gemfile
90
80
  - LICENSE
91
81
  - README.md
@@ -154,33 +144,26 @@ files:
154
144
  - spec/spec_helper.rb
155
145
  homepage: ''
156
146
  licenses: []
147
+ metadata: {}
157
148
  post_install_message:
158
149
  rdoc_options: []
159
150
  require_paths:
160
151
  - lib
161
152
  required_ruby_version: !ruby/object:Gem::Requirement
162
- none: false
163
153
  requirements:
164
- - - ! '>='
154
+ - - ">="
165
155
  - !ruby/object:Gem::Version
166
156
  version: '0'
167
- segments:
168
- - 0
169
- hash: -2154555736974539328
170
157
  required_rubygems_version: !ruby/object:Gem::Requirement
171
- none: false
172
158
  requirements:
173
- - - ! '>='
159
+ - - ">="
174
160
  - !ruby/object:Gem::Version
175
161
  version: '0'
176
- segments:
177
- - 0
178
- hash: -2154555736974539328
179
162
  requirements: []
180
163
  rubyforge_project: barcodes
181
- rubygems_version: 1.8.24
164
+ rubygems_version: 2.7.6
182
165
  signing_key:
183
- specification_version: 3
166
+ specification_version: 4
184
167
  summary: Barcode creation using Ruby!
185
168
  test_files:
186
169
  - spec/barcodes/exec_spec.rb
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm use ruby-1.9.2-p290@barcodes --create