barcode1dtools 0.9.9.2 → 1.0.0.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.
data/lib/barcode1dtools.rb
CHANGED
@@ -20,6 +20,9 @@ module Barcode1DTools
|
|
20
20
|
# PostNet, Plessey, MSI (Modified Plessey), Code 3 of 9, Code 93,
|
21
21
|
# Code 11, Code 128, and Codabar.
|
22
22
|
#
|
23
|
+
# Contact Michael Chaney Consulting Corporation for commercial
|
24
|
+
# support for this code: sales@michaelchaney.com
|
25
|
+
#
|
23
26
|
#== Example
|
24
27
|
# ean13 = Barcode1DTools::EAN13.new('0012676510226', :line_character => 'x', :space_character => ' ')
|
25
28
|
# => #<Barcode1DTools::EAN13:0x10030d670 @check_digit=10, @manufacturers_code="12676", @encoded_string="001267651022610", @number_system="00", @value="0012676510226", @product_code="51022", @options={:line_character=>"1", :space_character=>"0"}>
|
@@ -139,11 +139,6 @@ module Barcode1DTools
|
|
139
139
|
# intra-digit guard pattern, and "dddd" is the second
|
140
140
|
# digit. (ccdddd) occurs 4 times.
|
141
141
|
|
142
|
-
# See if the string is reversed
|
143
|
-
if str[28..30] == LEFT_GUARD_PATTERN_RLE.reverse && [7,13,19,25].all? { |x| str[29-x,2] == MIDDLE_GUARD_PATTERN_RLE.reverse }
|
144
|
-
str.reverse!
|
145
|
-
end
|
146
|
-
|
147
142
|
# Check the guard patterns
|
148
143
|
unless (str[0..2] == LEFT_GUARD_PATTERN_RLE && [7,13,19,25].all? { |x| str[x,2] == MIDDLE_GUARD_PATTERN_RLE.reverse })
|
149
144
|
raise UnencodableCharactersError, "Missing or incorrect guard patterns"
|
data/test/test_barcode1dmsi.rb
CHANGED
@@ -17,7 +17,7 @@ class Barcode1DToolsMSITest < Test::Unit::TestCase
|
|
17
17
|
|
18
18
|
# Creates a random number from 1 to 10 digits long
|
19
19
|
def random_msi_value(len)
|
20
|
-
|
20
|
+
rand(10**len).to_s
|
21
21
|
end
|
22
22
|
|
23
23
|
def test_checksum_generation
|
@@ -17,7 +17,7 @@ class Barcode1DToolsPlesseyTest < Test::Unit::TestCase
|
|
17
17
|
|
18
18
|
# Creates a random number from 1 to 10 digits long
|
19
19
|
def random_plessey_value(len)
|
20
|
-
|
20
|
+
rand(10**len).to_s
|
21
21
|
end
|
22
22
|
|
23
23
|
def test_attr_readers
|
@@ -87,8 +87,5 @@ class Barcode1DToolsUPC_Supp5Test < Test::Unit::TestCase
|
|
87
87
|
assert_equal upcsupp5.value, upcsupp52.value
|
88
88
|
upcsupp53 = Barcode1DTools::UPC_Supplemental_5.decode(upcsupp5.rle)
|
89
89
|
assert_equal upcsupp5.value, upcsupp53.value
|
90
|
-
# Should also work in reverse
|
91
|
-
upcsupp54 = Barcode1DTools::UPC_Supplemental_5.decode(upcsupp5.bars.reverse)
|
92
|
-
assert_equal upcsupp5.value, upcsupp54.value
|
93
90
|
end
|
94
91
|
end
|
metadata
CHANGED
@@ -1,29 +1,42 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: barcode1dtools
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 95
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
- 0
|
11
|
+
version: 1.0.0.0
|
6
12
|
platform: ruby
|
7
|
-
authors:
|
13
|
+
authors:
|
8
14
|
- Michael Chaney
|
9
15
|
autorequire:
|
10
16
|
bindir: bin
|
11
17
|
cert_chain: []
|
12
|
-
|
18
|
+
|
19
|
+
date: 2012-09-27 00:00:00 -05:00
|
20
|
+
default_executable:
|
13
21
|
dependencies: []
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
\
|
21
|
-
|
22
|
+
|
23
|
+
description: "\t Barcode1D is a small library for handling many kinds of\n\
|
24
|
+
\t 1-dimensional barcodes. Currently implemented are Code 128, Code 3\n\
|
25
|
+
\t of 9, Code 93, Code 11, Codabar, Interleaved 2 of 5, COOP 2 of 5,\n\
|
26
|
+
\t Matrix 2 of 5, Industrial 2 of 5, IATA 2 of 5, PostNet, Plessey, MSI\n\
|
27
|
+
\t (Modified Plessey), EAN-13, EAN-8, UPC-A, UPC-E, UPC Supplemental 2,\n\
|
28
|
+
\t and UPC Supplemental 5. Patterns are created in either a simple\n\
|
29
|
+
\t format of bars and spaces or as a run-length encoded string. This\n\
|
30
|
+
\t only generates and decodes the patterns; actual display or reading\n\
|
31
|
+
\t from a device must be implemented by the programmer.\n"
|
22
32
|
email: mdchaney@michaelchaney.com
|
23
33
|
executables: []
|
34
|
+
|
24
35
|
extensions: []
|
36
|
+
|
25
37
|
extra_rdoc_files: []
|
26
|
-
|
38
|
+
|
39
|
+
files:
|
27
40
|
- lib/barcode1dtools/codabar.rb
|
28
41
|
- lib/barcode1dtools/code11.rb
|
29
42
|
- lib/barcode1dtools/code128.rb
|
@@ -65,33 +78,44 @@ files:
|
|
65
78
|
- test/test_barcode1dupce.rb
|
66
79
|
- test/test_barcode1dupcsupp2.rb
|
67
80
|
- test/test_barcode1dupcsupp5.rb
|
81
|
+
has_rdoc: true
|
68
82
|
homepage: http://rubygems.org/gems/barcode1dtools
|
69
|
-
licenses:
|
83
|
+
licenses:
|
70
84
|
- MIT
|
71
85
|
- GPL-2
|
72
86
|
post_install_message:
|
73
87
|
rdoc_options: []
|
74
|
-
|
88
|
+
|
89
|
+
require_paths:
|
75
90
|
- lib
|
76
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
92
|
none: false
|
78
|
-
requirements:
|
79
|
-
- -
|
80
|
-
- !ruby/object:Gem::Version
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
hash: 59
|
97
|
+
segments:
|
98
|
+
- 1
|
99
|
+
- 8
|
100
|
+
- 6
|
81
101
|
version: 1.8.6
|
82
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
103
|
none: false
|
84
|
-
requirements:
|
85
|
-
- -
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
hash: 3
|
108
|
+
segments:
|
109
|
+
- 0
|
110
|
+
version: "0"
|
88
111
|
requirements: []
|
112
|
+
|
89
113
|
rubyforge_project:
|
90
|
-
rubygems_version: 1.
|
114
|
+
rubygems_version: 1.5.3
|
91
115
|
signing_key:
|
92
116
|
specification_version: 3
|
93
117
|
summary: Pattern generators for 1D barcodes
|
94
|
-
test_files:
|
118
|
+
test_files:
|
95
119
|
- test/test_barcode1d.rb
|
96
120
|
- test/test_barcode1dcodabar.rb
|
97
121
|
- test/test_barcode1dcode11.rb
|