pdf417 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,52 @@
1
+ # Basic testing file, run via make clean && ruby extconf.rb && make && ruby test.rb
2
+ require 'pdf417'
3
+
4
+ class PDF417
5
+ attr_accessor :text
6
+ def inspect # :nodoc:
7
+ attributes = inspect_attributes.reject { |x|
8
+ begin
9
+ attribute = send x
10
+ !attribute || (attribute.respond_to?(:empty?) && attribute.empty?)
11
+ rescue NoMethodError
12
+ true
13
+ end
14
+ }.map { |attribute|
15
+ "#{attribute.to_s}=#{send(attribute).inspect}"
16
+ }.join ' '
17
+ "#<#{self.class.name}:#{sprintf("0x%x", object_id)} #{attributes}>"
18
+ end
19
+
20
+
21
+ private
22
+ def inspect_attributes
23
+ [:text, :bit_columns, :bit_length, :code_rows, :code_columns, :codeword_length, :error_level, :generation_options, :aspect_ratio, :y_height, :generation_error]
24
+ end
25
+ end
26
+
27
+
28
+ puts "Testing codewords for 'fred'"
29
+ PDF417.encode_text("fred").each_with_index{|cw,i| puts "Ruby thinks cw #{i} is #{cw}"}
30
+ # For fred, should return:
31
+ # Ruby thinks cw 0 is 4
32
+ # Ruby thinks cw 1 is 815
33
+ # Ruby thinks cw 2 is 514
34
+ # Ruby thinks cw 3 is 119
35
+
36
+ p = PDF417.new("test")
37
+ puts p.inspect
38
+ p = PDF417.new("fred")
39
+ puts p.text
40
+ puts p.codewords.inspect
41
+ puts p.to_blob.inspect
42
+ puts p.bit_columns
43
+ puts p.bit_length
44
+ puts p.code_rows
45
+ puts p.code_columns
46
+ puts p.codeword_length
47
+ puts p.error_level
48
+ puts p.generation_options
49
+ puts p.aspect_ratio
50
+ puts p.y_height
51
+ puts p.generation_error
52
+ puts p.inspect
@@ -0,0 +1,24 @@
1
+ require 'pdf417/pdf417'
2
+
3
+ class PDF417
4
+ attr_accessor :text
5
+ def inspect # :nodoc:
6
+ attributes = inspect_attributes.reject { |x|
7
+ begin
8
+ attribute = send x
9
+ !attribute || (attribute.respond_to?(:empty?) && attribute.empty?)
10
+ rescue NoMethodError
11
+ true
12
+ end
13
+ }.map { |attribute|
14
+ "#{attribute.to_s}=#{send(attribute).inspect}"
15
+ }.join ' '
16
+ "#<#{self.class.name}:#{sprintf("0x%x", object_id)} #{attributes}>"
17
+ end
18
+
19
+
20
+ private
21
+ def inspect_attributes
22
+ [:text, :bit_columns, :bit_length, :code_rows, :code_columns, :codeword_length, :error_level, :generation_options, :aspect_ratio, :y_height, :generation_error]
23
+ end
24
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class Pdf417Test < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'pdf417'
8
+
9
+ class Test::Unit::TestCase
10
+ end
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pdf417
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - jamesprior
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2011-03-29 00:00:00 -04:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Generate a series of codewords or a binary blob for PDF417 barcodes
17
+ email: j.prior@asee.org
18
+ executables: []
19
+
20
+ extensions:
21
+ - ext/pdf417/extconf.rb
22
+ extra_rdoc_files:
23
+ - LICENSE
24
+ - README.rdoc
25
+ files:
26
+ - .document
27
+ - .gitignore
28
+ - LICENSE
29
+ - README.rdoc
30
+ - Rakefile
31
+ - VERSION
32
+ - ext/pdf417/Makefile
33
+ - ext/pdf417/extconf.rb
34
+ - ext/pdf417/pdf417.c
35
+ - ext/pdf417/pdf417.h
36
+ - ext/pdf417/pdf417lib.c
37
+ - ext/pdf417/pdf417lib.h
38
+ - ext/pdf417/pdf417libimp.h
39
+ - ext/pdf417/test.rb
40
+ - lib/pdf417.rb
41
+ - test/pdf417_test.rb
42
+ - test/test_helper.rb
43
+ has_rdoc: true
44
+ homepage: http://github.com/asee/pdf417
45
+ licenses: []
46
+
47
+ post_install_message:
48
+ rdoc_options:
49
+ - --charset=UTF-8
50
+ require_paths:
51
+ - lib
52
+ - ext
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: "0"
58
+ version:
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: "0"
64
+ version:
65
+ requirements: []
66
+
67
+ rubyforge_project:
68
+ rubygems_version: 1.3.5
69
+ signing_key:
70
+ specification_version: 3
71
+ summary: A Ruby wrapper for the PDF417 barcode library
72
+ test_files:
73
+ - test/pdf417_test.rb
74
+ - test/test_helper.rb