pngqr 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +1 -0
- data/Manifest +5 -0
- data/README +34 -0
- data/Rakefile +8 -0
- data/lib/pngqr.rb +15 -0
- data/pngqr.gemspec +36 -0
- metadata +101 -0
data/CHANGELOG
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
v0.1. Initial commit
|
data/Manifest
ADDED
data/README
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
|
2
|
+
PNGQR (Ping-queer?)
|
3
|
+
-------------------
|
4
|
+
|
5
|
+
Ruby Gem to generate PNG files with QR codes in them.
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
Usage
|
10
|
+
-----
|
11
|
+
|
12
|
+
Example:
|
13
|
+
|
14
|
+
require 'pngqr'
|
15
|
+
File.open('out.png','wb') {|io| io << Pngqr.encode('https://github.com/andys') }
|
16
|
+
|
17
|
+
The parameters for encode() are the same as the rqrcode gem's new().
|
18
|
+
See: http://whomwah.github.com/rqrcode/
|
19
|
+
|
20
|
+
|
21
|
+
Requirements
|
22
|
+
------------
|
23
|
+
|
24
|
+
Gems: rqrcode and chunky_png (both pure ruby gems)
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
Contact the author
|
30
|
+
------------------
|
31
|
+
|
32
|
+
Andrew Snow <andrew@modulus.org>
|
33
|
+
Andys^ on irc.freenode.net
|
34
|
+
@andy_snow on the twitter
|
data/Rakefile
ADDED
data/lib/pngqr.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'chunky_png'
|
3
|
+
require 'rqrcode'
|
4
|
+
|
5
|
+
|
6
|
+
class Pngqr
|
7
|
+
def self.encode(*opts)
|
8
|
+
qr = RQRCode::QRCode.new(*opts)
|
9
|
+
len = qr.module_count
|
10
|
+
png = ChunkyPNG::Image.new(len, len, ChunkyPNG::Color::WHITE)
|
11
|
+
(0...len).each {|row| (0...len).each {|col| png[col, row] = ChunkyPNG::Color::BLACK if qr.modules[row][col] } }
|
12
|
+
png.to_blob(:fast_rgb)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
data/pngqr.gemspec
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{pngqr}
|
5
|
+
s.version = "0.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Andrew Snow"]
|
9
|
+
s.date = %q{2011-03-07}
|
10
|
+
s.description = %q{Ruby Gem to generate PNG files with QR codes in them}
|
11
|
+
s.email = %q{andrew@modulus.org}
|
12
|
+
s.extra_rdoc_files = ["CHANGELOG", "README", "lib/pngqr.rb"]
|
13
|
+
s.files = ["CHANGELOG", "Manifest", "README", "Rakefile", "lib/pngqr.rb", "pngqr.gemspec"]
|
14
|
+
s.homepage = %q{}
|
15
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Pngqr", "--main", "README"]
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubyforge_project = %q{pngqr}
|
18
|
+
s.rubygems_version = %q{1.3.7}
|
19
|
+
s.summary = %q{Ruby Gem to generate PNG files with QR codes in them}
|
20
|
+
|
21
|
+
if s.respond_to? :specification_version then
|
22
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
23
|
+
s.specification_version = 3
|
24
|
+
|
25
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
26
|
+
s.add_runtime_dependency(%q<chunky_png>, [">= 0"])
|
27
|
+
s.add_runtime_dependency(%q<rqrcode>, [">= 0"])
|
28
|
+
else
|
29
|
+
s.add_dependency(%q<chunky_png>, [">= 0"])
|
30
|
+
s.add_dependency(%q<rqrcode>, [">= 0"])
|
31
|
+
end
|
32
|
+
else
|
33
|
+
s.add_dependency(%q<chunky_png>, [">= 0"])
|
34
|
+
s.add_dependency(%q<rqrcode>, [">= 0"])
|
35
|
+
end
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pngqr
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
version: "0.1"
|
9
|
+
platform: ruby
|
10
|
+
authors:
|
11
|
+
- Andrew Snow
|
12
|
+
autorequire:
|
13
|
+
bindir: bin
|
14
|
+
cert_chain: []
|
15
|
+
|
16
|
+
date: 2011-03-07 00:00:00 +11:00
|
17
|
+
default_executable:
|
18
|
+
dependencies:
|
19
|
+
- !ruby/object:Gem::Dependency
|
20
|
+
name: chunky_png
|
21
|
+
prerelease: false
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
version: "0"
|
30
|
+
type: :runtime
|
31
|
+
version_requirements: *id001
|
32
|
+
- !ruby/object:Gem::Dependency
|
33
|
+
name: rqrcode
|
34
|
+
prerelease: false
|
35
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
segments:
|
41
|
+
- 0
|
42
|
+
version: "0"
|
43
|
+
type: :runtime
|
44
|
+
version_requirements: *id002
|
45
|
+
description: Ruby Gem to generate PNG files with QR codes in them
|
46
|
+
email: andrew@modulus.org
|
47
|
+
executables: []
|
48
|
+
|
49
|
+
extensions: []
|
50
|
+
|
51
|
+
extra_rdoc_files:
|
52
|
+
- CHANGELOG
|
53
|
+
- README
|
54
|
+
- lib/pngqr.rb
|
55
|
+
files:
|
56
|
+
- CHANGELOG
|
57
|
+
- Manifest
|
58
|
+
- README
|
59
|
+
- Rakefile
|
60
|
+
- lib/pngqr.rb
|
61
|
+
- pngqr.gemspec
|
62
|
+
has_rdoc: true
|
63
|
+
homepage: ""
|
64
|
+
licenses: []
|
65
|
+
|
66
|
+
post_install_message:
|
67
|
+
rdoc_options:
|
68
|
+
- --line-numbers
|
69
|
+
- --inline-source
|
70
|
+
- --title
|
71
|
+
- Pngqr
|
72
|
+
- --main
|
73
|
+
- README
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
segments:
|
82
|
+
- 0
|
83
|
+
version: "0"
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
segments:
|
90
|
+
- 1
|
91
|
+
- 2
|
92
|
+
version: "1.2"
|
93
|
+
requirements: []
|
94
|
+
|
95
|
+
rubyforge_project: pngqr
|
96
|
+
rubygems_version: 1.3.7
|
97
|
+
signing_key:
|
98
|
+
specification_version: 3
|
99
|
+
summary: Ruby Gem to generate PNG files with QR codes in them
|
100
|
+
test_files: []
|
101
|
+
|