rqrcode 0.9.0 → 0.10.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.
- checksums.yaml +4 -4
- data/CHANGELOG +8 -0
- data/README.md +25 -0
- data/images/ansi-screen-shot.png +0 -0
- data/images/github-qrcode.png +0 -0
- data/images/github-qrcode.svg +31 -0
- data/lib/rqrcode.rb +3 -0
- data/lib/rqrcode/export/ansi.rb +78 -0
- data/lib/rqrcode/qrcode/qr_numeric.rb +1 -10
- data/lib/rqrcode/version.rb +1 -1
- data/test/data.rb +2 -0
- data/test/test_rqrcode_export.rb +5 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0f6962bd7ab53695b7d64327ee01be0921bddf6
|
4
|
+
data.tar.gz: c2844ccc6c2fc736236fd82794c89a27cdc02918
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5364262f8becf15bef10bbd7b2b72e19201a5131bbf6cd0ad463b27305ae91786b95ca5ec08a61fda66cbd18bab29a9c6e53628d1d76b3e87b9ad1f2a3c59911
|
7
|
+
data.tar.gz: de4b69f860dcdaa003154aee8e7cd397ba8417c9b3611790f4e09bc85922e65ef19f2c9e28e42a80b829215c883021f377faad142015dfe89b7d4a09c6e0b194
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
*0.10.0* (Feb 11, 2016)
|
2
|
+
|
3
|
+
- Merged as_ansi by [Andy Brody](https://github.com/ab)
|
4
|
+
|
5
|
+
*0.8.2* (Jan 3, 2016)
|
6
|
+
|
7
|
+
- Fix source encoding problem introduced in 0.8.1
|
8
|
+
|
1
9
|
*0.9.0* (Jan 3, 2016)
|
2
10
|
|
3
11
|
- Added support for auto selecting qrcode size up to level 40. (only worked up to level 10 before)
|
data/README.md
CHANGED
@@ -6,6 +6,10 @@
|
|
6
6
|
|
7
7
|
## Short changelog
|
8
8
|
|
9
|
+
*0.10.0* (Feb 11, 2016)
|
10
|
+
|
11
|
+
- Merged as_ansi by [Andy Brody](https://github.com/ab)
|
12
|
+
|
9
13
|
*0.9.0* (Jan 3, 2016)
|
10
14
|
|
11
15
|
- Added support for auto selecting qrcode size up to level 40. (only worked up to level 10 before)
|
@@ -49,6 +53,7 @@ qrcode = RQRCode::QRCode.new("http://github.com/")
|
|
49
53
|
image = qrcode.as_png
|
50
54
|
svg = qrcode.as_svg
|
51
55
|
html = qrcode.as_html
|
56
|
+
string = qrcode.as_ansi
|
52
57
|
string = qrcode.to_s
|
53
58
|
```
|
54
59
|
|
@@ -65,6 +70,22 @@ svg = qrcode.as_svg(offset: 0, color: '000',
|
|
65
70
|
module_size: 11)
|
66
71
|
```
|
67
72
|
|
73
|
+

|
74
|
+
|
75
|
+
### ANSI
|
76
|
+
|
77
|
+
The ANSI renderer will produce as a string with ANSI color codes.
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
qrcode = RQRCode::QRCode.new("http://github.com/")
|
81
|
+
# With default options specified explicitly
|
82
|
+
svg = qrcode.as_ansi_(light: "\033[47m", dark: "\033[40m",
|
83
|
+
fill_character: ' ',
|
84
|
+
quiet_zone_size: 4)
|
85
|
+
```
|
86
|
+
|
87
|
+

|
88
|
+
|
68
89
|
### PNG
|
69
90
|
|
70
91
|
The library can produce a PNG. Result will be a `ChunkyPNG::Image` instance.
|
@@ -82,8 +103,11 @@ png = qrcode.as_png(
|
|
82
103
|
module_px_size: 6,
|
83
104
|
file: nil # path to write
|
84
105
|
)
|
106
|
+
IO.write("/tmp/github-qrcode.png", png.to_s)
|
85
107
|
```
|
86
108
|
|
109
|
+

|
110
|
+
|
87
111
|
## HTML Rendering
|
88
112
|
### In your controller
|
89
113
|
```ruby
|
@@ -170,6 +194,7 @@ Original author: Duncan Robertson
|
|
170
194
|
|
171
195
|
Special thanks to the following people for submitting patches:
|
172
196
|
|
197
|
+
* [Andy Brody](https://github.com/ab)
|
173
198
|
* [Chris Mowforth](http://blog.99th.st)
|
174
199
|
* [Daniel Schierbeck](https://github.com/dasch)
|
175
200
|
* [Gioele Barabucci](https://github.com/gioele)
|
Binary file
|
Binary file
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events" width="319" height="319" shape-rendering="crispEdges">
|
2
|
+
<rect width="11" height="11" x="0" y="0" style="fill:#000"/><rect width="11" height="11" x="11" y="0" style="fill:#000"/><rect width="11" height="11" x="22" y="0" style="fill:#000"/><rect width="11" height="11" x="33" y="0" style="fill:#000"/><rect width="11" height="11" x="44" y="0" style="fill:#000"/><rect width="11" height="11" x="55" y="0" style="fill:#000"/><rect width="11" height="11" x="66" y="0" style="fill:#000"/><rect width="11" height="11" x="99" y="0" style="fill:#000"/><rect width="11" height="11" x="110" y="0" style="fill:#000"/><rect width="11" height="11" x="121" y="0" style="fill:#000"/><rect width="11" height="11" x="143" y="0" style="fill:#000"/><rect width="11" height="11" x="198" y="0" style="fill:#000"/><rect width="11" height="11" x="209" y="0" style="fill:#000"/><rect width="11" height="11" x="242" y="0" style="fill:#000"/><rect width="11" height="11" x="253" y="0" style="fill:#000"/><rect width="11" height="11" x="264" y="0" style="fill:#000"/><rect width="11" height="11" x="275" y="0" style="fill:#000"/><rect width="11" height="11" x="286" y="0" style="fill:#000"/><rect width="11" height="11" x="297" y="0" style="fill:#000"/><rect width="11" height="11" x="308" y="0" style="fill:#000"/>
|
3
|
+
<rect width="11" height="11" x="0" y="11" style="fill:#000"/><rect width="11" height="11" x="66" y="11" style="fill:#000"/><rect width="11" height="11" x="110" y="11" style="fill:#000"/><rect width="11" height="11" x="121" y="11" style="fill:#000"/><rect width="11" height="11" x="143" y="11" style="fill:#000"/><rect width="11" height="11" x="154" y="11" style="fill:#000"/><rect width="11" height="11" x="165" y="11" style="fill:#000"/><rect width="11" height="11" x="176" y="11" style="fill:#000"/><rect width="11" height="11" x="198" y="11" style="fill:#000"/><rect width="11" height="11" x="220" y="11" style="fill:#000"/><rect width="11" height="11" x="242" y="11" style="fill:#000"/><rect width="11" height="11" x="308" y="11" style="fill:#000"/>
|
4
|
+
<rect width="11" height="11" x="0" y="22" style="fill:#000"/><rect width="11" height="11" x="22" y="22" style="fill:#000"/><rect width="11" height="11" x="33" y="22" style="fill:#000"/><rect width="11" height="11" x="44" y="22" style="fill:#000"/><rect width="11" height="11" x="66" y="22" style="fill:#000"/><rect width="11" height="11" x="88" y="22" style="fill:#000"/><rect width="11" height="11" x="99" y="22" style="fill:#000"/><rect width="11" height="11" x="132" y="22" style="fill:#000"/><rect width="11" height="11" x="165" y="22" style="fill:#000"/><rect width="11" height="11" x="198" y="22" style="fill:#000"/><rect width="11" height="11" x="220" y="22" style="fill:#000"/><rect width="11" height="11" x="242" y="22" style="fill:#000"/><rect width="11" height="11" x="264" y="22" style="fill:#000"/><rect width="11" height="11" x="275" y="22" style="fill:#000"/><rect width="11" height="11" x="286" y="22" style="fill:#000"/><rect width="11" height="11" x="308" y="22" style="fill:#000"/>
|
5
|
+
<rect width="11" height="11" x="0" y="33" style="fill:#000"/><rect width="11" height="11" x="22" y="33" style="fill:#000"/><rect width="11" height="11" x="33" y="33" style="fill:#000"/><rect width="11" height="11" x="44" y="33" style="fill:#000"/><rect width="11" height="11" x="66" y="33" style="fill:#000"/><rect width="11" height="11" x="88" y="33" style="fill:#000"/><rect width="11" height="11" x="99" y="33" style="fill:#000"/><rect width="11" height="11" x="110" y="33" style="fill:#000"/><rect width="11" height="11" x="143" y="33" style="fill:#000"/><rect width="11" height="11" x="165" y="33" style="fill:#000"/><rect width="11" height="11" x="187" y="33" style="fill:#000"/><rect width="11" height="11" x="209" y="33" style="fill:#000"/><rect width="11" height="11" x="220" y="33" style="fill:#000"/><rect width="11" height="11" x="242" y="33" style="fill:#000"/><rect width="11" height="11" x="264" y="33" style="fill:#000"/><rect width="11" height="11" x="275" y="33" style="fill:#000"/><rect width="11" height="11" x="286" y="33" style="fill:#000"/><rect width="11" height="11" x="308" y="33" style="fill:#000"/>
|
6
|
+
<rect width="11" height="11" x="0" y="44" style="fill:#000"/><rect width="11" height="11" x="22" y="44" style="fill:#000"/><rect width="11" height="11" x="33" y="44" style="fill:#000"/><rect width="11" height="11" x="44" y="44" style="fill:#000"/><rect width="11" height="11" x="66" y="44" style="fill:#000"/><rect width="11" height="11" x="110" y="44" style="fill:#000"/><rect width="11" height="11" x="121" y="44" style="fill:#000"/><rect width="11" height="11" x="132" y="44" style="fill:#000"/><rect width="11" height="11" x="143" y="44" style="fill:#000"/><rect width="11" height="11" x="154" y="44" style="fill:#000"/><rect width="11" height="11" x="165" y="44" style="fill:#000"/><rect width="11" height="11" x="176" y="44" style="fill:#000"/><rect width="11" height="11" x="187" y="44" style="fill:#000"/><rect width="11" height="11" x="209" y="44" style="fill:#000"/><rect width="11" height="11" x="242" y="44" style="fill:#000"/><rect width="11" height="11" x="264" y="44" style="fill:#000"/><rect width="11" height="11" x="275" y="44" style="fill:#000"/><rect width="11" height="11" x="286" y="44" style="fill:#000"/><rect width="11" height="11" x="308" y="44" style="fill:#000"/>
|
7
|
+
<rect width="11" height="11" x="0" y="55" style="fill:#000"/><rect width="11" height="11" x="66" y="55" style="fill:#000"/><rect width="11" height="11" x="110" y="55" style="fill:#000"/><rect width="11" height="11" x="121" y="55" style="fill:#000"/><rect width="11" height="11" x="165" y="55" style="fill:#000"/><rect width="11" height="11" x="187" y="55" style="fill:#000"/><rect width="11" height="11" x="198" y="55" style="fill:#000"/><rect width="11" height="11" x="242" y="55" style="fill:#000"/><rect width="11" height="11" x="308" y="55" style="fill:#000"/>
|
8
|
+
<rect width="11" height="11" x="0" y="66" style="fill:#000"/><rect width="11" height="11" x="11" y="66" style="fill:#000"/><rect width="11" height="11" x="22" y="66" style="fill:#000"/><rect width="11" height="11" x="33" y="66" style="fill:#000"/><rect width="11" height="11" x="44" y="66" style="fill:#000"/><rect width="11" height="11" x="55" y="66" style="fill:#000"/><rect width="11" height="11" x="66" y="66" style="fill:#000"/><rect width="11" height="11" x="88" y="66" style="fill:#000"/><rect width="11" height="11" x="110" y="66" style="fill:#000"/><rect width="11" height="11" x="132" y="66" style="fill:#000"/><rect width="11" height="11" x="154" y="66" style="fill:#000"/><rect width="11" height="11" x="176" y="66" style="fill:#000"/><rect width="11" height="11" x="198" y="66" style="fill:#000"/><rect width="11" height="11" x="220" y="66" style="fill:#000"/><rect width="11" height="11" x="242" y="66" style="fill:#000"/><rect width="11" height="11" x="253" y="66" style="fill:#000"/><rect width="11" height="11" x="264" y="66" style="fill:#000"/><rect width="11" height="11" x="275" y="66" style="fill:#000"/><rect width="11" height="11" x="286" y="66" style="fill:#000"/><rect width="11" height="11" x="297" y="66" style="fill:#000"/><rect width="11" height="11" x="308" y="66" style="fill:#000"/>
|
9
|
+
<rect width="11" height="11" x="99" y="77" style="fill:#000"/><rect width="11" height="11" x="132" y="77" style="fill:#000"/><rect width="11" height="11" x="143" y="77" style="fill:#000"/><rect width="11" height="11" x="154" y="77" style="fill:#000"/><rect width="11" height="11" x="209" y="77" style="fill:#000"/>
|
10
|
+
<rect width="11" height="11" x="33" y="88" style="fill:#000"/><rect width="11" height="11" x="44" y="88" style="fill:#000"/><rect width="11" height="11" x="66" y="88" style="fill:#000"/><rect width="11" height="11" x="77" y="88" style="fill:#000"/><rect width="11" height="11" x="99" y="88" style="fill:#000"/><rect width="11" height="11" x="132" y="88" style="fill:#000"/><rect width="11" height="11" x="165" y="88" style="fill:#000"/><rect width="11" height="11" x="176" y="88" style="fill:#000"/><rect width="11" height="11" x="198" y="88" style="fill:#000"/><rect width="11" height="11" x="209" y="88" style="fill:#000"/><rect width="11" height="11" x="220" y="88" style="fill:#000"/><rect width="11" height="11" x="275" y="88" style="fill:#000"/><rect width="11" height="11" x="286" y="88" style="fill:#000"/>
|
11
|
+
<rect width="11" height="11" x="22" y="99" style="fill:#000"/><rect width="11" height="11" x="33" y="99" style="fill:#000"/><rect width="11" height="11" x="44" y="99" style="fill:#000"/><rect width="11" height="11" x="55" y="99" style="fill:#000"/><rect width="11" height="11" x="99" y="99" style="fill:#000"/><rect width="11" height="11" x="132" y="99" style="fill:#000"/><rect width="11" height="11" x="143" y="99" style="fill:#000"/><rect width="11" height="11" x="154" y="99" style="fill:#000"/><rect width="11" height="11" x="176" y="99" style="fill:#000"/><rect width="11" height="11" x="220" y="99" style="fill:#000"/><rect width="11" height="11" x="242" y="99" style="fill:#000"/><rect width="11" height="11" x="264" y="99" style="fill:#000"/><rect width="11" height="11" x="275" y="99" style="fill:#000"/><rect width="11" height="11" x="297" y="99" style="fill:#000"/>
|
12
|
+
<rect width="11" height="11" x="11" y="110" style="fill:#000"/><rect width="11" height="11" x="33" y="110" style="fill:#000"/><rect width="11" height="11" x="66" y="110" style="fill:#000"/><rect width="11" height="11" x="88" y="110" style="fill:#000"/><rect width="11" height="11" x="143" y="110" style="fill:#000"/><rect width="11" height="11" x="198" y="110" style="fill:#000"/><rect width="11" height="11" x="242" y="110" style="fill:#000"/>
|
13
|
+
<rect width="11" height="11" x="11" y="121" style="fill:#000"/><rect width="11" height="11" x="22" y="121" style="fill:#000"/><rect width="11" height="11" x="33" y="121" style="fill:#000"/><rect width="11" height="11" x="55" y="121" style="fill:#000"/><rect width="11" height="11" x="77" y="121" style="fill:#000"/><rect width="11" height="11" x="88" y="121" style="fill:#000"/><rect width="11" height="11" x="99" y="121" style="fill:#000"/><rect width="11" height="11" x="132" y="121" style="fill:#000"/><rect width="11" height="11" x="143" y="121" style="fill:#000"/><rect width="11" height="11" x="154" y="121" style="fill:#000"/><rect width="11" height="11" x="176" y="121" style="fill:#000"/><rect width="11" height="11" x="198" y="121" style="fill:#000"/><rect width="11" height="11" x="231" y="121" style="fill:#000"/><rect width="11" height="11" x="275" y="121" style="fill:#000"/><rect width="11" height="11" x="308" y="121" style="fill:#000"/>
|
14
|
+
<rect width="11" height="11" x="44" y="132" style="fill:#000"/><rect width="11" height="11" x="66" y="132" style="fill:#000"/><rect width="11" height="11" x="77" y="132" style="fill:#000"/><rect width="11" height="11" x="88" y="132" style="fill:#000"/><rect width="11" height="11" x="99" y="132" style="fill:#000"/><rect width="11" height="11" x="110" y="132" style="fill:#000"/><rect width="11" height="11" x="143" y="132" style="fill:#000"/><rect width="11" height="11" x="165" y="132" style="fill:#000"/><rect width="11" height="11" x="187" y="132" style="fill:#000"/><rect width="11" height="11" x="209" y="132" style="fill:#000"/><rect width="11" height="11" x="231" y="132" style="fill:#000"/><rect width="11" height="11" x="242" y="132" style="fill:#000"/><rect width="11" height="11" x="253" y="132" style="fill:#000"/><rect width="11" height="11" x="275" y="132" style="fill:#000"/><rect width="11" height="11" x="297" y="132" style="fill:#000"/>
|
15
|
+
<rect width="11" height="11" x="11" y="143" style="fill:#000"/><rect width="11" height="11" x="22" y="143" style="fill:#000"/><rect width="11" height="11" x="44" y="143" style="fill:#000"/><rect width="11" height="11" x="55" y="143" style="fill:#000"/><rect width="11" height="11" x="143" y="143" style="fill:#000"/><rect width="11" height="11" x="154" y="143" style="fill:#000"/><rect width="11" height="11" x="187" y="143" style="fill:#000"/><rect width="11" height="11" x="242" y="143" style="fill:#000"/><rect width="11" height="11" x="264" y="143" style="fill:#000"/><rect width="11" height="11" x="286" y="143" style="fill:#000"/><rect width="11" height="11" x="308" y="143" style="fill:#000"/>
|
16
|
+
<rect width="11" height="11" x="0" y="154" style="fill:#000"/><rect width="11" height="11" x="22" y="154" style="fill:#000"/><rect width="11" height="11" x="33" y="154" style="fill:#000"/><rect width="11" height="11" x="55" y="154" style="fill:#000"/><rect width="11" height="11" x="66" y="154" style="fill:#000"/><rect width="11" height="11" x="77" y="154" style="fill:#000"/><rect width="11" height="11" x="88" y="154" style="fill:#000"/><rect width="11" height="11" x="132" y="154" style="fill:#000"/><rect width="11" height="11" x="143" y="154" style="fill:#000"/><rect width="11" height="11" x="198" y="154" style="fill:#000"/><rect width="11" height="11" x="209" y="154" style="fill:#000"/><rect width="11" height="11" x="220" y="154" style="fill:#000"/><rect width="11" height="11" x="275" y="154" style="fill:#000"/><rect width="11" height="11" x="297" y="154" style="fill:#000"/><rect width="11" height="11" x="308" y="154" style="fill:#000"/>
|
17
|
+
<rect width="11" height="11" x="0" y="165" style="fill:#000"/><rect width="11" height="11" x="22" y="165" style="fill:#000"/><rect width="11" height="11" x="55" y="165" style="fill:#000"/><rect width="11" height="11" x="110" y="165" style="fill:#000"/><rect width="11" height="11" x="143" y="165" style="fill:#000"/><rect width="11" height="11" x="187" y="165" style="fill:#000"/><rect width="11" height="11" x="198" y="165" style="fill:#000"/><rect width="11" height="11" x="220" y="165" style="fill:#000"/><rect width="11" height="11" x="275" y="165" style="fill:#000"/><rect width="11" height="11" x="286" y="165" style="fill:#000"/>
|
18
|
+
<rect width="11" height="11" x="33" y="176" style="fill:#000"/><rect width="11" height="11" x="44" y="176" style="fill:#000"/><rect width="11" height="11" x="55" y="176" style="fill:#000"/><rect width="11" height="11" x="66" y="176" style="fill:#000"/><rect width="11" height="11" x="88" y="176" style="fill:#000"/><rect width="11" height="11" x="110" y="176" style="fill:#000"/><rect width="11" height="11" x="132" y="176" style="fill:#000"/><rect width="11" height="11" x="143" y="176" style="fill:#000"/><rect width="11" height="11" x="154" y="176" style="fill:#000"/><rect width="11" height="11" x="198" y="176" style="fill:#000"/><rect width="11" height="11" x="209" y="176" style="fill:#000"/><rect width="11" height="11" x="220" y="176" style="fill:#000"/><rect width="11" height="11" x="242" y="176" style="fill:#000"/><rect width="11" height="11" x="253" y="176" style="fill:#000"/><rect width="11" height="11" x="275" y="176" style="fill:#000"/><rect width="11" height="11" x="297" y="176" style="fill:#000"/>
|
19
|
+
<rect width="11" height="11" x="0" y="187" style="fill:#000"/><rect width="11" height="11" x="11" y="187" style="fill:#000"/><rect width="11" height="11" x="22" y="187" style="fill:#000"/><rect width="11" height="11" x="33" y="187" style="fill:#000"/><rect width="11" height="11" x="99" y="187" style="fill:#000"/><rect width="11" height="11" x="121" y="187" style="fill:#000"/><rect width="11" height="11" x="176" y="187" style="fill:#000"/><rect width="11" height="11" x="187" y="187" style="fill:#000"/><rect width="11" height="11" x="198" y="187" style="fill:#000"/><rect width="11" height="11" x="220" y="187" style="fill:#000"/><rect width="11" height="11" x="242" y="187" style="fill:#000"/><rect width="11" height="11" x="253" y="187" style="fill:#000"/><rect width="11" height="11" x="264" y="187" style="fill:#000"/>
|
20
|
+
<rect width="11" height="11" x="0" y="198" style="fill:#000"/><rect width="11" height="11" x="11" y="198" style="fill:#000"/><rect width="11" height="11" x="33" y="198" style="fill:#000"/><rect width="11" height="11" x="44" y="198" style="fill:#000"/><rect width="11" height="11" x="66" y="198" style="fill:#000"/><rect width="11" height="11" x="110" y="198" style="fill:#000"/><rect width="11" height="11" x="132" y="198" style="fill:#000"/><rect width="11" height="11" x="165" y="198" style="fill:#000"/><rect width="11" height="11" x="220" y="198" style="fill:#000"/><rect width="11" height="11" x="264" y="198" style="fill:#000"/><rect width="11" height="11" x="308" y="198" style="fill:#000"/>
|
21
|
+
<rect width="11" height="11" x="0" y="209" style="fill:#000"/><rect width="11" height="11" x="11" y="209" style="fill:#000"/><rect width="11" height="11" x="22" y="209" style="fill:#000"/><rect width="11" height="11" x="33" y="209" style="fill:#000"/><rect width="11" height="11" x="44" y="209" style="fill:#000"/><rect width="11" height="11" x="55" y="209" style="fill:#000"/><rect width="11" height="11" x="77" y="209" style="fill:#000"/><rect width="11" height="11" x="88" y="209" style="fill:#000"/><rect width="11" height="11" x="110" y="209" style="fill:#000"/><rect width="11" height="11" x="132" y="209" style="fill:#000"/><rect width="11" height="11" x="143" y="209" style="fill:#000"/><rect width="11" height="11" x="165" y="209" style="fill:#000"/><rect width="11" height="11" x="231" y="209" style="fill:#000"/><rect width="11" height="11" x="242" y="209" style="fill:#000"/><rect width="11" height="11" x="253" y="209" style="fill:#000"/><rect width="11" height="11" x="286" y="209" style="fill:#000"/><rect width="11" height="11" x="308" y="209" style="fill:#000"/>
|
22
|
+
<rect width="11" height="11" x="0" y="220" style="fill:#000"/><rect width="11" height="11" x="11" y="220" style="fill:#000"/><rect width="11" height="11" x="22" y="220" style="fill:#000"/><rect width="11" height="11" x="55" y="220" style="fill:#000"/><rect width="11" height="11" x="66" y="220" style="fill:#000"/><rect width="11" height="11" x="110" y="220" style="fill:#000"/><rect width="11" height="11" x="121" y="220" style="fill:#000"/><rect width="11" height="11" x="132" y="220" style="fill:#000"/><rect width="11" height="11" x="198" y="220" style="fill:#000"/><rect width="11" height="11" x="220" y="220" style="fill:#000"/><rect width="11" height="11" x="231" y="220" style="fill:#000"/><rect width="11" height="11" x="242" y="220" style="fill:#000"/><rect width="11" height="11" x="253" y="220" style="fill:#000"/><rect width="11" height="11" x="264" y="220" style="fill:#000"/><rect width="11" height="11" x="275" y="220" style="fill:#000"/><rect width="11" height="11" x="286" y="220" style="fill:#000"/><rect width="11" height="11" x="297" y="220" style="fill:#000"/><rect width="11" height="11" x="308" y="220" style="fill:#000"/>
|
23
|
+
<rect width="11" height="11" x="88" y="231" style="fill:#000"/><rect width="11" height="11" x="110" y="231" style="fill:#000"/><rect width="11" height="11" x="143" y="231" style="fill:#000"/><rect width="11" height="11" x="154" y="231" style="fill:#000"/><rect width="11" height="11" x="220" y="231" style="fill:#000"/><rect width="11" height="11" x="264" y="231" style="fill:#000"/><rect width="11" height="11" x="275" y="231" style="fill:#000"/><rect width="11" height="11" x="286" y="231" style="fill:#000"/>
|
24
|
+
<rect width="11" height="11" x="0" y="242" style="fill:#000"/><rect width="11" height="11" x="11" y="242" style="fill:#000"/><rect width="11" height="11" x="22" y="242" style="fill:#000"/><rect width="11" height="11" x="33" y="242" style="fill:#000"/><rect width="11" height="11" x="44" y="242" style="fill:#000"/><rect width="11" height="11" x="55" y="242" style="fill:#000"/><rect width="11" height="11" x="66" y="242" style="fill:#000"/><rect width="11" height="11" x="88" y="242" style="fill:#000"/><rect width="11" height="11" x="121" y="242" style="fill:#000"/><rect width="11" height="11" x="132" y="242" style="fill:#000"/><rect width="11" height="11" x="209" y="242" style="fill:#000"/><rect width="11" height="11" x="220" y="242" style="fill:#000"/><rect width="11" height="11" x="242" y="242" style="fill:#000"/><rect width="11" height="11" x="264" y="242" style="fill:#000"/><rect width="11" height="11" x="286" y="242" style="fill:#000"/>
|
25
|
+
<rect width="11" height="11" x="0" y="253" style="fill:#000"/><rect width="11" height="11" x="66" y="253" style="fill:#000"/><rect width="11" height="11" x="110" y="253" style="fill:#000"/><rect width="11" height="11" x="121" y="253" style="fill:#000"/><rect width="11" height="11" x="132" y="253" style="fill:#000"/><rect width="11" height="11" x="143" y="253" style="fill:#000"/><rect width="11" height="11" x="176" y="253" style="fill:#000"/><rect width="11" height="11" x="198" y="253" style="fill:#000"/><rect width="11" height="11" x="209" y="253" style="fill:#000"/><rect width="11" height="11" x="220" y="253" style="fill:#000"/><rect width="11" height="11" x="264" y="253" style="fill:#000"/><rect width="11" height="11" x="275" y="253" style="fill:#000"/><rect width="11" height="11" x="297" y="253" style="fill:#000"/><rect width="11" height="11" x="308" y="253" style="fill:#000"/>
|
26
|
+
<rect width="11" height="11" x="0" y="264" style="fill:#000"/><rect width="11" height="11" x="22" y="264" style="fill:#000"/><rect width="11" height="11" x="33" y="264" style="fill:#000"/><rect width="11" height="11" x="44" y="264" style="fill:#000"/><rect width="11" height="11" x="66" y="264" style="fill:#000"/><rect width="11" height="11" x="88" y="264" style="fill:#000"/><rect width="11" height="11" x="99" y="264" style="fill:#000"/><rect width="11" height="11" x="132" y="264" style="fill:#000"/><rect width="11" height="11" x="187" y="264" style="fill:#000"/><rect width="11" height="11" x="198" y="264" style="fill:#000"/><rect width="11" height="11" x="209" y="264" style="fill:#000"/><rect width="11" height="11" x="220" y="264" style="fill:#000"/><rect width="11" height="11" x="231" y="264" style="fill:#000"/><rect width="11" height="11" x="242" y="264" style="fill:#000"/><rect width="11" height="11" x="253" y="264" style="fill:#000"/><rect width="11" height="11" x="264" y="264" style="fill:#000"/><rect width="11" height="11" x="308" y="264" style="fill:#000"/>
|
27
|
+
<rect width="11" height="11" x="0" y="275" style="fill:#000"/><rect width="11" height="11" x="22" y="275" style="fill:#000"/><rect width="11" height="11" x="33" y="275" style="fill:#000"/><rect width="11" height="11" x="44" y="275" style="fill:#000"/><rect width="11" height="11" x="66" y="275" style="fill:#000"/><rect width="11" height="11" x="88" y="275" style="fill:#000"/><rect width="11" height="11" x="110" y="275" style="fill:#000"/><rect width="11" height="11" x="121" y="275" style="fill:#000"/><rect width="11" height="11" x="132" y="275" style="fill:#000"/><rect width="11" height="11" x="143" y="275" style="fill:#000"/><rect width="11" height="11" x="154" y="275" style="fill:#000"/><rect width="11" height="11" x="176" y="275" style="fill:#000"/><rect width="11" height="11" x="231" y="275" style="fill:#000"/><rect width="11" height="11" x="253" y="275" style="fill:#000"/><rect width="11" height="11" x="297" y="275" style="fill:#000"/>
|
28
|
+
<rect width="11" height="11" x="0" y="286" style="fill:#000"/><rect width="11" height="11" x="22" y="286" style="fill:#000"/><rect width="11" height="11" x="33" y="286" style="fill:#000"/><rect width="11" height="11" x="44" y="286" style="fill:#000"/><rect width="11" height="11" x="66" y="286" style="fill:#000"/><rect width="11" height="11" x="110" y="286" style="fill:#000"/><rect width="11" height="11" x="121" y="286" style="fill:#000"/><rect width="11" height="11" x="132" y="286" style="fill:#000"/><rect width="11" height="11" x="165" y="286" style="fill:#000"/><rect width="11" height="11" x="231" y="286" style="fill:#000"/><rect width="11" height="11" x="264" y="286" style="fill:#000"/><rect width="11" height="11" x="286" y="286" style="fill:#000"/><rect width="11" height="11" x="297" y="286" style="fill:#000"/><rect width="11" height="11" x="308" y="286" style="fill:#000"/>
|
29
|
+
<rect width="11" height="11" x="0" y="297" style="fill:#000"/><rect width="11" height="11" x="66" y="297" style="fill:#000"/><rect width="11" height="11" x="99" y="297" style="fill:#000"/><rect width="11" height="11" x="132" y="297" style="fill:#000"/><rect width="11" height="11" x="154" y="297" style="fill:#000"/><rect width="11" height="11" x="209" y="297" style="fill:#000"/><rect width="11" height="11" x="220" y="297" style="fill:#000"/><rect width="11" height="11" x="242" y="297" style="fill:#000"/><rect width="11" height="11" x="264" y="297" style="fill:#000"/><rect width="11" height="11" x="275" y="297" style="fill:#000"/><rect width="11" height="11" x="286" y="297" style="fill:#000"/><rect width="11" height="11" x="308" y="297" style="fill:#000"/>
|
30
|
+
<rect width="11" height="11" x="0" y="308" style="fill:#000"/><rect width="11" height="11" x="11" y="308" style="fill:#000"/><rect width="11" height="11" x="22" y="308" style="fill:#000"/><rect width="11" height="11" x="33" y="308" style="fill:#000"/><rect width="11" height="11" x="44" y="308" style="fill:#000"/><rect width="11" height="11" x="55" y="308" style="fill:#000"/><rect width="11" height="11" x="66" y="308" style="fill:#000"/><rect width="11" height="11" x="99" y="308" style="fill:#000"/><rect width="11" height="11" x="154" y="308" style="fill:#000"/><rect width="11" height="11" x="176" y="308" style="fill:#000"/><rect width="11" height="11" x="198" y="308" style="fill:#000"/><rect width="11" height="11" x="220" y="308" style="fill:#000"/><rect width="11" height="11" x="253" y="308" style="fill:#000"/><rect width="11" height="11" x="264" y="308" style="fill:#000"/>
|
31
|
+
</svg>
|
data/lib/rqrcode.rb
CHANGED
@@ -9,8 +9,11 @@
|
|
9
9
|
# above copyright notice is included.
|
10
10
|
#++
|
11
11
|
|
12
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
13
|
+
|
12
14
|
require "rqrcode/core_ext"
|
13
15
|
require "rqrcode/qrcode"
|
14
16
|
require 'rqrcode/export/png'
|
15
17
|
require 'rqrcode/export/svg'
|
16
18
|
require 'rqrcode/export/html'
|
19
|
+
require 'rqrcode/export/ansi'
|
@@ -0,0 +1,78 @@
|
|
1
|
+
module RQRCode
|
2
|
+
module Export
|
3
|
+
module ANSI
|
4
|
+
##
|
5
|
+
# Returns a string of the QR code as
|
6
|
+
# characters writen with ANSI background set.
|
7
|
+
#
|
8
|
+
# Options:
|
9
|
+
# light: Foreground ("\033[47m")
|
10
|
+
# dark: Background ANSI code. ("\033[47m")
|
11
|
+
# fill_character: The written character. (' ')
|
12
|
+
# quiet_zone_size: (4)
|
13
|
+
#
|
14
|
+
def as_ansi(options={})
|
15
|
+
options = {
|
16
|
+
light: "\033[47m",
|
17
|
+
dark: "\033[40m",
|
18
|
+
fill_character: ' ',
|
19
|
+
quiet_zone_size: 4
|
20
|
+
}.merge(options)
|
21
|
+
|
22
|
+
normal = "\033[m"
|
23
|
+
light = options.fetch(:light)
|
24
|
+
dark = options.fetch(:dark)
|
25
|
+
fill_character = options.fetch(:fill_character)
|
26
|
+
quiet_zone_size = options.fetch(:quiet_zone_size)
|
27
|
+
|
28
|
+
output = ''
|
29
|
+
|
30
|
+
@modules.each_index do |c|
|
31
|
+
|
32
|
+
# start row with quiet zone
|
33
|
+
row = light + fill_character * quiet_zone_size
|
34
|
+
previous_dark = false
|
35
|
+
|
36
|
+
@modules.each_index do |r|
|
37
|
+
if is_dark(c, r)
|
38
|
+
# dark
|
39
|
+
if previous_dark != true
|
40
|
+
row << dark
|
41
|
+
previous_dark = true
|
42
|
+
end
|
43
|
+
row << fill_character
|
44
|
+
else
|
45
|
+
# light
|
46
|
+
if previous_dark != false
|
47
|
+
row << light
|
48
|
+
previous_dark = false
|
49
|
+
end
|
50
|
+
row << fill_character
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# add quiet zone
|
55
|
+
if previous_dark != false
|
56
|
+
row << light
|
57
|
+
end
|
58
|
+
row << fill_character * quiet_zone_size
|
59
|
+
|
60
|
+
# always end with reset and newline
|
61
|
+
row << normal + "\n"
|
62
|
+
|
63
|
+
output << row
|
64
|
+
end
|
65
|
+
|
66
|
+
# count the row width so we can add quiet zone rows
|
67
|
+
width = output.each_line.first.scan(fill_character).length
|
68
|
+
|
69
|
+
quiet_row = light + fill_character * width + normal + "\n"
|
70
|
+
quiet_rows = quiet_row * quiet_zone_size
|
71
|
+
|
72
|
+
return quiet_rows + output + quiet_rows
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
RQRCode::QRCode.send :include, RQRCode::Export::ANSI
|
@@ -31,16 +31,7 @@ module RQRCode
|
|
31
31
|
|
32
32
|
(@data.size).times do |i|
|
33
33
|
if i % 3 == 0
|
34
|
-
chars = @data[i]
|
35
|
-
|
36
|
-
if @data[i + 1]
|
37
|
-
chars << @data[i + 1]
|
38
|
-
end
|
39
|
-
|
40
|
-
if @data[i + 2]
|
41
|
-
chars << @data[i + 2]
|
42
|
-
end
|
43
|
-
|
34
|
+
chars = @data[i, 3]
|
44
35
|
bit_length = get_bit_length(chars.length)
|
45
36
|
buffer.put( get_code(chars), bit_length )
|
46
37
|
end
|
data/lib/rqrcode/version.rb
CHANGED
data/test/data.rb
CHANGED
@@ -21,3 +21,5 @@ MATRIX_4_M = [[true, true, true, true, true, true, true, false, true, true, fals
|
|
21
21
|
MATRIX_4_Q = [[true, true, true, true, true, true, true, false, false, true, true, true, false, true, true, true, false, true, true, false, false, true, true, false, true, false, true, true, true, true, true, true, true], [true, false, false, false, false, false, true, false, true, false, false, true, false, false, false, true, true, false, true, true, false, false, false, false, false, false, true, false, false, false, false, false, true], [true, false, true, true, true, false, true, false, false, false, true, true, true, false, true, false, false, false, false, true, true, true, false, true, true, false, true, false, true, true, true, false, true], [true, false, true, true, true, false, true, false, true, false, false, false, true, true, true, false, true, false, true, true, true, false, true, true, true, false, true, false, true, true, true, false, true], [true, false, true, true, true, false, true, false, true, false, true, true, false, false, true, true, false, false, false, false, false, false, true, true, false, false, true, false, true, true, true, false, true], [true, false, false, false, false, false, true, false, false, true, true, false, true, true, false, true, false, true, false, true, false, true, false, false, true, false, true, false, false, false, false, false, true], [true, true, true, true, true, true, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, true, true, true, true, true, true], [false, false, false, false, false, false, false, false, true, true, false, true, true, true, true, false, false, false, false, false, false, false, true, true, false, false, false, false, false, false, false, false, false], [false, true, false, true, true, true, true, false, true, false, false, false, true, true, false, false, true, true, false, false, false, false, false, true, true, true, true, false, true, true, false, true, false], [false, false, false, true, true, true, false, false, true, true, false, false, true, false, false, true, false, true, true, true, false, true, false, true, false, false, false, false, true, true, true, false, false], [true, false, false, false, true, false, true, false, true, false, true, false, true, true, true, false, true, false, false, false, false, false, true, true, false, false, true, false, true, false, false, true, true], [false, false, false, true, true, false, false, false, false, true, false, false, true, false, true, false, false, false, true, false, false, true, true, true, false, false, true, false, true, false, true, true, true], [true, true, true, false, false, true, true, true, false, true, true, false, true, false, false, true, true, true, false, true, false, true, false, true, false, false, true, true, false, false, false, false, false], [true, false, false, false, true, false, false, false, true, false, false, true, true, false, false, true, false, false, true, true, true, false, false, false, true, true, false, true, false, false, true, false, false], [true, false, true, false, true, true, true, true, false, false, false, false, true, false, true, false, true, true, true, true, true, true, true, false, false, false, true, true, true, false, false, false, false], [true, false, true, true, false, false, false, false, false, true, true, true, true, false, false, false, true, false, false, false, true, false, true, false, true, false, false, false, true, false, true, true, false], [false, false, true, false, false, false, true, false, true, false, true, false, false, true, true, true, false, true, true, false, true, false, true, true, false, true, true, true, true, false, false, true, true], [true, true, false, false, true, false, false, true, false, true, true, false, false, true, false, true, false, true, false, true, true, false, false, false, false, false, true, true, true, false, true, false, true], [true, false, true, true, true, true, true, true, true, false, false, false, true, true, true, false, true, false, false, true, true, true, true, true, true, false, false, true, false, false, false, true, true], [true, false, false, false, true, true, false, false, true, true, false, true, false, false, false, true, true, true, true, false, true, false, true, true, false, true, true, false, false, false, true, false, false], [true, false, true, true, false, true, true, false, true, false, true, true, false, false, false, true, true, true, false, true, false, true, true, true, true, false, false, false, false, false, false, true, false], [true, false, true, false, true, true, false, false, false, true, false, false, false, true, false, false, true, false, true, false, false, false, false, false, false, true, false, false, true, false, true, true, false], [true, false, false, false, true, false, true, false, true, true, false, true, false, false, false, true, true, false, true, true, true, false, false, false, true, false, true, false, false, true, true, true, true], [true, false, false, false, false, false, false, false, true, false, false, false, false, true, true, false, false, true, true, true, true, false, true, false, false, true, true, false, false, true, true, true, false], [true, true, true, false, false, true, true, false, true, true, false, false, true, true, false, false, false, false, true, false, false, false, false, false, true, true, true, true, true, false, false, true, true], [false, false, false, false, false, false, false, false, true, true, false, false, true, false, true, true, true, false, false, false, false, true, false, false, true, false, false, false, true, true, false, false, false], [true, true, true, true, true, true, true, false, false, true, false, true, true, true, true, true, true, false, true, true, true, false, false, true, true, false, true, false, true, false, false, false, false], [true, false, false, false, false, false, true, false, true, true, false, true, true, true, false, false, true, false, false, true, false, true, true, false, true, false, false, false, true, true, true, true, true], [true, false, true, true, true, false, true, false, true, false, true, true, false, false, false, false, true, false, true, false, false, true, true, true, true, true, true, true, true, true, false, true, true], [true, false, true, true, true, false, true, false, true, true, false, false, true, true, true, false, true, false, true, false, false, true, true, false, false, true, false, false, false, true, true, false, true], [true, false, true, true, true, false, true, false, false, true, true, false, true, true, false, false, true, true, true, true, false, false, false, false, false, true, false, false, true, true, true, true, true], [true, false, false, false, false, false, true, false, true, true, false, false, true, false, false, true, false, true, false, true, true, false, true, false, true, false, true, false, true, false, true, true, true], [true, true, true, true, true, true, true, false, false, true, true, false, true, true, true, false, true, false, true, true, false, false, false, false, true, false, true, true, true, true, false, false, false]]
|
22
22
|
|
23
23
|
MATRIX_UTF8_RU_test = [[true, true, true, true, true, true, true, false, true, false, true, true, true, true, true, false, false, false, true, true, true, true, true, true, true], [true, false, false, false, false, false, true, false, false, false, false, false, true, true, true, true, true, false, true, false, false, false, false, false, true], [true, false, true, true, true, false, true, false, true, false, false, true, false, true, true, true, true, false, true, false, true, true, true, false, true], [true, false, true, true, true, false, true, false, false, false, true, false, true, true, false, true, true, false, true, false, true, true, true, false, true], [true, false, true, true, true, false, true, false, true, false, false, true, true, true, false, true, false, false, true, false, true, true, true, false, true], [true, false, false, false, false, false, true, false, false, true, false, false, true, true, false, true, false, false, true, false, false, false, false, false, true], [true, true, true, true, true, true, true, false, true, false, true, false, true, false, true, false, true, false, true, true, true, true, true, true, true], [false, false, false, false, false, false, false, false, true, true, true, false, false, false, false, true, true, false, false, false, false, false, false, false, false], [false, false, false, false, false, true, true, false, false, false, true, false, true, true, false, true, false, false, true, false, true, false, true, false, true], [false, false, false, false, false, true, false, true, true, true, true, true, false, true, true, true, false, false, true, true, false, false, true, true, true], [false, true, true, false, true, true, true, false, false, false, false, false, false, true, false, false, false, false, true, false, true, true, false, true, false], [true, true, false, false, true, false, false, false, false, false, true, false, false, false, false, true, false, true, true, true, true, false, true, false, false], [false, false, false, false, false, false, true, true, false, false, false, false, true, true, false, false, false, true, true, true, true, false, false, true, true], [true, true, true, true, false, true, false, false, false, true, false, true, false, false, true, false, false, true, true, false, false, true, false, false, true], [true, false, false, true, true, false, true, true, true, false, false, true, true, true, false, true, true, true, false, false, true, false, false, false, false], [true, false, false, false, false, false, false, false, true, true, false, false, false, true, false, false, true, false, false, false, true, true, false, true, true], [true, false, true, true, true, true, true, true, false, false, true, false, false, true, true, true, true, true, true, true, true, false, false, false, true], [false, false, false, false, false, false, false, false, true, false, false, false, false, true, true, false, true, false, false, false, true, false, false, true, true], [true, true, true, true, true, true, true, false, false, true, true, true, false, true, false, true, true, false, true, false, true, false, true, false, false], [true, false, false, false, false, false, true, false, true, true, false, false, true, false, true, true, true, false, false, false, true, false, true, false, true], [true, false, true, true, true, false, true, false, false, true, false, true, true, false, false, false, true, true, true, true, true, true, false, false, false], [true, false, true, true, true, false, true, false, false, true, true, true, true, true, false, false, false, true, false, false, true, false, true, false, true], [true, false, true, true, true, false, true, false, false, true, false, false, false, true, false, false, true, false, true, false, true, false, false, false, true], [true, false, false, false, false, false, true, false, false, true, false, false, false, false, true, true, false, false, true, true, false, true, true, false, true], [true, true, true, true, true, true, true, false, false, true, false, true, false, false, false, true, true, false, true, true, true, false, true, false, true]]
|
24
|
+
|
25
|
+
AS_ANSI = "\e[47m \e[m\n\e[47m \e[m\n\e[47m \e[m\n\e[47m \e[m\n\e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[m\n\e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[m\n\e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[m\n\e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[m\n\e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[m\n\e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[m\n\e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[m\n\e[47m \e[40m \e[47m \e[m\n\e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[m\n\e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[m\n\e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[m\n\e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[m\n\e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[m\n\e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[m\n\e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[m\n\e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[m\n\e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[m\n\e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[m\n\e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[m\n\e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[m\n\e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[40m \e[47m \e[m\n\e[47m \e[m\n\e[47m \e[m\n\e[47m \e[m\n\e[47m \e[m\n"
|
data/test/test_rqrcode_export.rb
CHANGED
@@ -2,7 +2,7 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
describe :QRCodeExportTest do
|
4
4
|
|
5
|
-
[:svg, :png, :html].each do |ext|
|
5
|
+
[:svg, :png, :html, :ansi].each do |ext|
|
6
6
|
it "must respond_to #{ext}" do
|
7
7
|
RQRCode::QRCode.new('x').must_respond_to :"as_#{ext}"
|
8
8
|
end
|
@@ -19,5 +19,9 @@ describe :QRCodeExportTest do
|
|
19
19
|
it "must export to html" do
|
20
20
|
RQRCode::QRCode.new('html').as_html.must_match(/<table>.+<\/table>/)
|
21
21
|
end
|
22
|
+
|
23
|
+
it "must export to ansi" do
|
24
|
+
RQRCode::QRCode.new('ansi').as_ansi.must_equal(AS_ANSI)
|
25
|
+
end
|
22
26
|
|
23
27
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rqrcode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Björn Blomqvist
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-02-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: chunky_png
|
@@ -74,12 +74,16 @@ files:
|
|
74
74
|
- README.md
|
75
75
|
- Rakefile
|
76
76
|
- TODO.md
|
77
|
+
- images/ansi-screen-shot.png
|
78
|
+
- images/github-qrcode.png
|
79
|
+
- images/github-qrcode.svg
|
77
80
|
- lib/rqrcode.rb
|
78
81
|
- lib/rqrcode/core_ext.rb
|
79
82
|
- lib/rqrcode/core_ext/array.rb
|
80
83
|
- lib/rqrcode/core_ext/array/behavior.rb
|
81
84
|
- lib/rqrcode/core_ext/integer.rb
|
82
85
|
- lib/rqrcode/core_ext/integer/bitwise.rb
|
86
|
+
- lib/rqrcode/export/ansi.rb
|
83
87
|
- lib/rqrcode/export/html.rb
|
84
88
|
- lib/rqrcode/export/png.rb
|
85
89
|
- lib/rqrcode/export/svg.rb
|