rqrcode 0.8.2 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ruby.yml +20 -0
  3. data/.gitignore +9 -1
  4. data/Gemfile +3 -8
  5. data/LICENSE.txt +21 -0
  6. data/README.md +121 -123
  7. data/Rakefile +6 -10
  8. data/_config.yml +1 -0
  9. data/bin/console +14 -0
  10. data/bin/setup +8 -0
  11. data/images/ansi-screen-shot.png +0 -0
  12. data/images/github-qrcode.png +0 -0
  13. data/images/github-qrcode.svg +32 -0
  14. data/lib/rqrcode.rb +7 -15
  15. data/{test/helper.rb → lib/rqrcode/export.rb} +3 -6
  16. data/lib/rqrcode/export/ansi.rb +77 -0
  17. data/lib/rqrcode/export/html.rb +6 -8
  18. data/lib/rqrcode/export/png.rb +18 -19
  19. data/lib/rqrcode/export/svg.rb +16 -7
  20. data/lib/rqrcode/qrcode.rb +3 -4
  21. data/lib/rqrcode/qrcode/qrcode.rb +17 -0
  22. data/lib/rqrcode/version.rb +3 -1
  23. data/rqrcode.gemspec +28 -24
  24. metadata +62 -55
  25. data/.travis.yml +0 -7
  26. data/CHANGELOG +0 -84
  27. data/LICENSE +0 -19
  28. data/TODO.md +0 -4
  29. data/lib/rqrcode/core_ext.rb +0 -5
  30. data/lib/rqrcode/core_ext/array.rb +0 -5
  31. data/lib/rqrcode/core_ext/array/behavior.rb +0 -12
  32. data/lib/rqrcode/core_ext/integer.rb +0 -5
  33. data/lib/rqrcode/core_ext/integer/bitwise.rb +0 -13
  34. data/lib/rqrcode/qrcode/qr_8bit_byte.rb +0 -36
  35. data/lib/rqrcode/qrcode/qr_alphanumeric.rb +0 -47
  36. data/lib/rqrcode/qrcode/qr_bit_buffer.rb +0 -99
  37. data/lib/rqrcode/qrcode/qr_code.rb +0 -492
  38. data/lib/rqrcode/qrcode/qr_math.rb +0 -63
  39. data/lib/rqrcode/qrcode/qr_numeric.rb +0 -66
  40. data/lib/rqrcode/qrcode/qr_polynomial.rb +0 -78
  41. data/lib/rqrcode/qrcode/qr_rs_block.rb +0 -314
  42. data/lib/rqrcode/qrcode/qr_util.rb +0 -272
  43. data/test/data.rb +0 -23
  44. data/test/test_regresions.rb +0 -10
  45. data/test/test_rqrcode.rb +0 -125
  46. data/test/test_rqrcode_export.rb +0 -23
Binary file
@@ -0,0 +1,32 @@
1
+ <?xml version="1.0" standalone="yes"?>
2
+ <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="174" height="174" shape-rendering="crispEdges">
3
+ <rect width="6" height="6" x="0" y="0" style="fill:#000"/><rect width="6" height="6" x="6" y="0" style="fill:#000"/><rect width="6" height="6" x="12" y="0" style="fill:#000"/><rect width="6" height="6" x="18" y="0" style="fill:#000"/><rect width="6" height="6" x="24" y="0" style="fill:#000"/><rect width="6" height="6" x="30" y="0" style="fill:#000"/><rect width="6" height="6" x="36" y="0" style="fill:#000"/><rect width="6" height="6" x="54" y="0" style="fill:#000"/><rect width="6" height="6" x="60" y="0" style="fill:#000"/><rect width="6" height="6" x="66" y="0" style="fill:#000"/><rect width="6" height="6" x="78" y="0" style="fill:#000"/><rect width="6" height="6" x="108" y="0" style="fill:#000"/><rect width="6" height="6" x="114" y="0" style="fill:#000"/><rect width="6" height="6" x="132" y="0" style="fill:#000"/><rect width="6" height="6" x="138" y="0" style="fill:#000"/><rect width="6" height="6" x="144" y="0" style="fill:#000"/><rect width="6" height="6" x="150" y="0" style="fill:#000"/><rect width="6" height="6" x="156" y="0" style="fill:#000"/><rect width="6" height="6" x="162" y="0" style="fill:#000"/><rect width="6" height="6" x="168" y="0" style="fill:#000"/>
4
+ <rect width="6" height="6" x="0" y="6" style="fill:#000"/><rect width="6" height="6" x="36" y="6" style="fill:#000"/><rect width="6" height="6" x="60" y="6" style="fill:#000"/><rect width="6" height="6" x="66" y="6" style="fill:#000"/><rect width="6" height="6" x="78" y="6" style="fill:#000"/><rect width="6" height="6" x="84" y="6" style="fill:#000"/><rect width="6" height="6" x="90" y="6" style="fill:#000"/><rect width="6" height="6" x="96" y="6" style="fill:#000"/><rect width="6" height="6" x="108" y="6" style="fill:#000"/><rect width="6" height="6" x="120" y="6" style="fill:#000"/><rect width="6" height="6" x="132" y="6" style="fill:#000"/><rect width="6" height="6" x="168" y="6" style="fill:#000"/>
5
+ <rect width="6" height="6" x="0" y="12" style="fill:#000"/><rect width="6" height="6" x="12" y="12" style="fill:#000"/><rect width="6" height="6" x="18" y="12" style="fill:#000"/><rect width="6" height="6" x="24" y="12" style="fill:#000"/><rect width="6" height="6" x="36" y="12" style="fill:#000"/><rect width="6" height="6" x="48" y="12" style="fill:#000"/><rect width="6" height="6" x="54" y="12" style="fill:#000"/><rect width="6" height="6" x="72" y="12" style="fill:#000"/><rect width="6" height="6" x="90" y="12" style="fill:#000"/><rect width="6" height="6" x="108" y="12" style="fill:#000"/><rect width="6" height="6" x="120" y="12" style="fill:#000"/><rect width="6" height="6" x="132" y="12" style="fill:#000"/><rect width="6" height="6" x="144" y="12" style="fill:#000"/><rect width="6" height="6" x="150" y="12" style="fill:#000"/><rect width="6" height="6" x="156" y="12" style="fill:#000"/><rect width="6" height="6" x="168" y="12" style="fill:#000"/>
6
+ <rect width="6" height="6" x="0" y="18" style="fill:#000"/><rect width="6" height="6" x="12" y="18" style="fill:#000"/><rect width="6" height="6" x="18" y="18" style="fill:#000"/><rect width="6" height="6" x="24" y="18" style="fill:#000"/><rect width="6" height="6" x="36" y="18" style="fill:#000"/><rect width="6" height="6" x="48" y="18" style="fill:#000"/><rect width="6" height="6" x="54" y="18" style="fill:#000"/><rect width="6" height="6" x="60" y="18" style="fill:#000"/><rect width="6" height="6" x="78" y="18" style="fill:#000"/><rect width="6" height="6" x="90" y="18" style="fill:#000"/><rect width="6" height="6" x="102" y="18" style="fill:#000"/><rect width="6" height="6" x="114" y="18" style="fill:#000"/><rect width="6" height="6" x="120" y="18" style="fill:#000"/><rect width="6" height="6" x="132" y="18" style="fill:#000"/><rect width="6" height="6" x="144" y="18" style="fill:#000"/><rect width="6" height="6" x="150" y="18" style="fill:#000"/><rect width="6" height="6" x="156" y="18" style="fill:#000"/><rect width="6" height="6" x="168" y="18" style="fill:#000"/>
7
+ <rect width="6" height="6" x="0" y="24" style="fill:#000"/><rect width="6" height="6" x="12" y="24" style="fill:#000"/><rect width="6" height="6" x="18" y="24" style="fill:#000"/><rect width="6" height="6" x="24" y="24" style="fill:#000"/><rect width="6" height="6" x="36" y="24" style="fill:#000"/><rect width="6" height="6" x="60" y="24" style="fill:#000"/><rect width="6" height="6" x="66" y="24" style="fill:#000"/><rect width="6" height="6" x="72" y="24" style="fill:#000"/><rect width="6" height="6" x="78" y="24" style="fill:#000"/><rect width="6" height="6" x="84" y="24" style="fill:#000"/><rect width="6" height="6" x="90" y="24" style="fill:#000"/><rect width="6" height="6" x="96" y="24" style="fill:#000"/><rect width="6" height="6" x="102" y="24" style="fill:#000"/><rect width="6" height="6" x="114" y="24" style="fill:#000"/><rect width="6" height="6" x="132" y="24" style="fill:#000"/><rect width="6" height="6" x="144" y="24" style="fill:#000"/><rect width="6" height="6" x="150" y="24" style="fill:#000"/><rect width="6" height="6" x="156" y="24" style="fill:#000"/><rect width="6" height="6" x="168" y="24" style="fill:#000"/>
8
+ <rect width="6" height="6" x="0" y="30" style="fill:#000"/><rect width="6" height="6" x="36" y="30" style="fill:#000"/><rect width="6" height="6" x="60" y="30" style="fill:#000"/><rect width="6" height="6" x="66" y="30" style="fill:#000"/><rect width="6" height="6" x="90" y="30" style="fill:#000"/><rect width="6" height="6" x="102" y="30" style="fill:#000"/><rect width="6" height="6" x="108" y="30" style="fill:#000"/><rect width="6" height="6" x="132" y="30" style="fill:#000"/><rect width="6" height="6" x="168" y="30" style="fill:#000"/>
9
+ <rect width="6" height="6" x="0" y="36" style="fill:#000"/><rect width="6" height="6" x="6" y="36" style="fill:#000"/><rect width="6" height="6" x="12" y="36" style="fill:#000"/><rect width="6" height="6" x="18" y="36" style="fill:#000"/><rect width="6" height="6" x="24" y="36" style="fill:#000"/><rect width="6" height="6" x="30" y="36" style="fill:#000"/><rect width="6" height="6" x="36" y="36" style="fill:#000"/><rect width="6" height="6" x="48" y="36" style="fill:#000"/><rect width="6" height="6" x="60" y="36" style="fill:#000"/><rect width="6" height="6" x="72" y="36" style="fill:#000"/><rect width="6" height="6" x="84" y="36" style="fill:#000"/><rect width="6" height="6" x="96" y="36" style="fill:#000"/><rect width="6" height="6" x="108" y="36" style="fill:#000"/><rect width="6" height="6" x="120" y="36" style="fill:#000"/><rect width="6" height="6" x="132" y="36" style="fill:#000"/><rect width="6" height="6" x="138" y="36" style="fill:#000"/><rect width="6" height="6" x="144" y="36" style="fill:#000"/><rect width="6" height="6" x="150" y="36" style="fill:#000"/><rect width="6" height="6" x="156" y="36" style="fill:#000"/><rect width="6" height="6" x="162" y="36" style="fill:#000"/><rect width="6" height="6" x="168" y="36" style="fill:#000"/>
10
+ <rect width="6" height="6" x="54" y="42" style="fill:#000"/><rect width="6" height="6" x="72" y="42" style="fill:#000"/><rect width="6" height="6" x="78" y="42" style="fill:#000"/><rect width="6" height="6" x="84" y="42" style="fill:#000"/><rect width="6" height="6" x="114" y="42" style="fill:#000"/>
11
+ <rect width="6" height="6" x="18" y="48" style="fill:#000"/><rect width="6" height="6" x="24" y="48" style="fill:#000"/><rect width="6" height="6" x="36" y="48" style="fill:#000"/><rect width="6" height="6" x="42" y="48" style="fill:#000"/><rect width="6" height="6" x="54" y="48" style="fill:#000"/><rect width="6" height="6" x="72" y="48" style="fill:#000"/><rect width="6" height="6" x="90" y="48" style="fill:#000"/><rect width="6" height="6" x="96" y="48" style="fill:#000"/><rect width="6" height="6" x="108" y="48" style="fill:#000"/><rect width="6" height="6" x="114" y="48" style="fill:#000"/><rect width="6" height="6" x="120" y="48" style="fill:#000"/><rect width="6" height="6" x="150" y="48" style="fill:#000"/><rect width="6" height="6" x="156" y="48" style="fill:#000"/>
12
+ <rect width="6" height="6" x="12" y="54" style="fill:#000"/><rect width="6" height="6" x="18" y="54" style="fill:#000"/><rect width="6" height="6" x="24" y="54" style="fill:#000"/><rect width="6" height="6" x="30" y="54" style="fill:#000"/><rect width="6" height="6" x="54" y="54" style="fill:#000"/><rect width="6" height="6" x="72" y="54" style="fill:#000"/><rect width="6" height="6" x="78" y="54" style="fill:#000"/><rect width="6" height="6" x="84" y="54" style="fill:#000"/><rect width="6" height="6" x="96" y="54" style="fill:#000"/><rect width="6" height="6" x="120" y="54" style="fill:#000"/><rect width="6" height="6" x="132" y="54" style="fill:#000"/><rect width="6" height="6" x="144" y="54" style="fill:#000"/><rect width="6" height="6" x="150" y="54" style="fill:#000"/><rect width="6" height="6" x="162" y="54" style="fill:#000"/>
13
+ <rect width="6" height="6" x="6" y="60" style="fill:#000"/><rect width="6" height="6" x="18" y="60" style="fill:#000"/><rect width="6" height="6" x="36" y="60" style="fill:#000"/><rect width="6" height="6" x="48" y="60" style="fill:#000"/><rect width="6" height="6" x="78" y="60" style="fill:#000"/><rect width="6" height="6" x="108" y="60" style="fill:#000"/><rect width="6" height="6" x="132" y="60" style="fill:#000"/>
14
+ <rect width="6" height="6" x="6" y="66" style="fill:#000"/><rect width="6" height="6" x="12" y="66" style="fill:#000"/><rect width="6" height="6" x="18" y="66" style="fill:#000"/><rect width="6" height="6" x="30" y="66" style="fill:#000"/><rect width="6" height="6" x="42" y="66" style="fill:#000"/><rect width="6" height="6" x="48" y="66" style="fill:#000"/><rect width="6" height="6" x="54" y="66" style="fill:#000"/><rect width="6" height="6" x="72" y="66" style="fill:#000"/><rect width="6" height="6" x="78" y="66" style="fill:#000"/><rect width="6" height="6" x="84" y="66" style="fill:#000"/><rect width="6" height="6" x="96" y="66" style="fill:#000"/><rect width="6" height="6" x="108" y="66" style="fill:#000"/><rect width="6" height="6" x="126" y="66" style="fill:#000"/><rect width="6" height="6" x="150" y="66" style="fill:#000"/><rect width="6" height="6" x="168" y="66" style="fill:#000"/>
15
+ <rect width="6" height="6" x="24" y="72" style="fill:#000"/><rect width="6" height="6" x="36" y="72" style="fill:#000"/><rect width="6" height="6" x="42" y="72" style="fill:#000"/><rect width="6" height="6" x="48" y="72" style="fill:#000"/><rect width="6" height="6" x="54" y="72" style="fill:#000"/><rect width="6" height="6" x="60" y="72" style="fill:#000"/><rect width="6" height="6" x="78" y="72" style="fill:#000"/><rect width="6" height="6" x="90" y="72" style="fill:#000"/><rect width="6" height="6" x="102" y="72" style="fill:#000"/><rect width="6" height="6" x="114" y="72" style="fill:#000"/><rect width="6" height="6" x="126" y="72" style="fill:#000"/><rect width="6" height="6" x="132" y="72" style="fill:#000"/><rect width="6" height="6" x="138" y="72" style="fill:#000"/><rect width="6" height="6" x="150" y="72" style="fill:#000"/><rect width="6" height="6" x="162" y="72" style="fill:#000"/>
16
+ <rect width="6" height="6" x="6" y="78" style="fill:#000"/><rect width="6" height="6" x="12" y="78" style="fill:#000"/><rect width="6" height="6" x="24" y="78" style="fill:#000"/><rect width="6" height="6" x="30" y="78" style="fill:#000"/><rect width="6" height="6" x="78" y="78" style="fill:#000"/><rect width="6" height="6" x="84" y="78" style="fill:#000"/><rect width="6" height="6" x="102" y="78" style="fill:#000"/><rect width="6" height="6" x="132" y="78" style="fill:#000"/><rect width="6" height="6" x="144" y="78" style="fill:#000"/><rect width="6" height="6" x="156" y="78" style="fill:#000"/><rect width="6" height="6" x="168" y="78" style="fill:#000"/>
17
+ <rect width="6" height="6" x="0" y="84" style="fill:#000"/><rect width="6" height="6" x="12" y="84" style="fill:#000"/><rect width="6" height="6" x="18" y="84" style="fill:#000"/><rect width="6" height="6" x="30" y="84" style="fill:#000"/><rect width="6" height="6" x="36" y="84" style="fill:#000"/><rect width="6" height="6" x="42" y="84" style="fill:#000"/><rect width="6" height="6" x="48" y="84" style="fill:#000"/><rect width="6" height="6" x="72" y="84" style="fill:#000"/><rect width="6" height="6" x="78" y="84" style="fill:#000"/><rect width="6" height="6" x="108" y="84" style="fill:#000"/><rect width="6" height="6" x="114" y="84" style="fill:#000"/><rect width="6" height="6" x="120" y="84" style="fill:#000"/><rect width="6" height="6" x="150" y="84" style="fill:#000"/><rect width="6" height="6" x="162" y="84" style="fill:#000"/><rect width="6" height="6" x="168" y="84" style="fill:#000"/>
18
+ <rect width="6" height="6" x="0" y="90" style="fill:#000"/><rect width="6" height="6" x="12" y="90" style="fill:#000"/><rect width="6" height="6" x="30" y="90" style="fill:#000"/><rect width="6" height="6" x="60" y="90" style="fill:#000"/><rect width="6" height="6" x="78" y="90" style="fill:#000"/><rect width="6" height="6" x="102" y="90" style="fill:#000"/><rect width="6" height="6" x="108" y="90" style="fill:#000"/><rect width="6" height="6" x="120" y="90" style="fill:#000"/><rect width="6" height="6" x="150" y="90" style="fill:#000"/><rect width="6" height="6" x="156" y="90" style="fill:#000"/>
19
+ <rect width="6" height="6" x="18" y="96" style="fill:#000"/><rect width="6" height="6" x="24" y="96" style="fill:#000"/><rect width="6" height="6" x="30" y="96" style="fill:#000"/><rect width="6" height="6" x="36" y="96" style="fill:#000"/><rect width="6" height="6" x="48" y="96" style="fill:#000"/><rect width="6" height="6" x="60" y="96" style="fill:#000"/><rect width="6" height="6" x="72" y="96" style="fill:#000"/><rect width="6" height="6" x="78" y="96" style="fill:#000"/><rect width="6" height="6" x="84" y="96" style="fill:#000"/><rect width="6" height="6" x="108" y="96" style="fill:#000"/><rect width="6" height="6" x="114" y="96" style="fill:#000"/><rect width="6" height="6" x="120" y="96" style="fill:#000"/><rect width="6" height="6" x="132" y="96" style="fill:#000"/><rect width="6" height="6" x="138" y="96" style="fill:#000"/><rect width="6" height="6" x="150" y="96" style="fill:#000"/><rect width="6" height="6" x="162" y="96" style="fill:#000"/>
20
+ <rect width="6" height="6" x="0" y="102" style="fill:#000"/><rect width="6" height="6" x="6" y="102" style="fill:#000"/><rect width="6" height="6" x="12" y="102" style="fill:#000"/><rect width="6" height="6" x="18" y="102" style="fill:#000"/><rect width="6" height="6" x="54" y="102" style="fill:#000"/><rect width="6" height="6" x="66" y="102" style="fill:#000"/><rect width="6" height="6" x="96" y="102" style="fill:#000"/><rect width="6" height="6" x="102" y="102" style="fill:#000"/><rect width="6" height="6" x="108" y="102" style="fill:#000"/><rect width="6" height="6" x="120" y="102" style="fill:#000"/><rect width="6" height="6" x="132" y="102" style="fill:#000"/><rect width="6" height="6" x="138" y="102" style="fill:#000"/><rect width="6" height="6" x="144" y="102" style="fill:#000"/>
21
+ <rect width="6" height="6" x="0" y="108" style="fill:#000"/><rect width="6" height="6" x="6" y="108" style="fill:#000"/><rect width="6" height="6" x="18" y="108" style="fill:#000"/><rect width="6" height="6" x="24" y="108" style="fill:#000"/><rect width="6" height="6" x="36" y="108" style="fill:#000"/><rect width="6" height="6" x="60" y="108" style="fill:#000"/><rect width="6" height="6" x="72" y="108" style="fill:#000"/><rect width="6" height="6" x="90" y="108" style="fill:#000"/><rect width="6" height="6" x="120" y="108" style="fill:#000"/><rect width="6" height="6" x="144" y="108" style="fill:#000"/><rect width="6" height="6" x="168" y="108" style="fill:#000"/>
22
+ <rect width="6" height="6" x="0" y="114" style="fill:#000"/><rect width="6" height="6" x="6" y="114" style="fill:#000"/><rect width="6" height="6" x="12" y="114" style="fill:#000"/><rect width="6" height="6" x="18" y="114" style="fill:#000"/><rect width="6" height="6" x="24" y="114" style="fill:#000"/><rect width="6" height="6" x="30" y="114" style="fill:#000"/><rect width="6" height="6" x="42" y="114" style="fill:#000"/><rect width="6" height="6" x="48" y="114" style="fill:#000"/><rect width="6" height="6" x="60" y="114" style="fill:#000"/><rect width="6" height="6" x="72" y="114" style="fill:#000"/><rect width="6" height="6" x="78" y="114" style="fill:#000"/><rect width="6" height="6" x="90" y="114" style="fill:#000"/><rect width="6" height="6" x="126" y="114" style="fill:#000"/><rect width="6" height="6" x="132" y="114" style="fill:#000"/><rect width="6" height="6" x="138" y="114" style="fill:#000"/><rect width="6" height="6" x="156" y="114" style="fill:#000"/><rect width="6" height="6" x="168" y="114" style="fill:#000"/>
23
+ <rect width="6" height="6" x="0" y="120" style="fill:#000"/><rect width="6" height="6" x="6" y="120" style="fill:#000"/><rect width="6" height="6" x="12" y="120" style="fill:#000"/><rect width="6" height="6" x="30" y="120" style="fill:#000"/><rect width="6" height="6" x="36" y="120" style="fill:#000"/><rect width="6" height="6" x="60" y="120" style="fill:#000"/><rect width="6" height="6" x="66" y="120" style="fill:#000"/><rect width="6" height="6" x="72" y="120" style="fill:#000"/><rect width="6" height="6" x="108" y="120" style="fill:#000"/><rect width="6" height="6" x="120" y="120" style="fill:#000"/><rect width="6" height="6" x="126" y="120" style="fill:#000"/><rect width="6" height="6" x="132" y="120" style="fill:#000"/><rect width="6" height="6" x="138" y="120" style="fill:#000"/><rect width="6" height="6" x="144" y="120" style="fill:#000"/><rect width="6" height="6" x="150" y="120" style="fill:#000"/><rect width="6" height="6" x="156" y="120" style="fill:#000"/><rect width="6" height="6" x="162" y="120" style="fill:#000"/><rect width="6" height="6" x="168" y="120" style="fill:#000"/>
24
+ <rect width="6" height="6" x="48" y="126" style="fill:#000"/><rect width="6" height="6" x="60" y="126" style="fill:#000"/><rect width="6" height="6" x="78" y="126" style="fill:#000"/><rect width="6" height="6" x="84" y="126" style="fill:#000"/><rect width="6" height="6" x="120" y="126" style="fill:#000"/><rect width="6" height="6" x="144" y="126" style="fill:#000"/><rect width="6" height="6" x="150" y="126" style="fill:#000"/><rect width="6" height="6" x="156" y="126" style="fill:#000"/>
25
+ <rect width="6" height="6" x="0" y="132" style="fill:#000"/><rect width="6" height="6" x="6" y="132" style="fill:#000"/><rect width="6" height="6" x="12" y="132" style="fill:#000"/><rect width="6" height="6" x="18" y="132" style="fill:#000"/><rect width="6" height="6" x="24" y="132" style="fill:#000"/><rect width="6" height="6" x="30" y="132" style="fill:#000"/><rect width="6" height="6" x="36" y="132" style="fill:#000"/><rect width="6" height="6" x="48" y="132" style="fill:#000"/><rect width="6" height="6" x="66" y="132" style="fill:#000"/><rect width="6" height="6" x="72" y="132" style="fill:#000"/><rect width="6" height="6" x="114" y="132" style="fill:#000"/><rect width="6" height="6" x="120" y="132" style="fill:#000"/><rect width="6" height="6" x="132" y="132" style="fill:#000"/><rect width="6" height="6" x="144" y="132" style="fill:#000"/><rect width="6" height="6" x="156" y="132" style="fill:#000"/>
26
+ <rect width="6" height="6" x="0" y="138" style="fill:#000"/><rect width="6" height="6" x="36" y="138" style="fill:#000"/><rect width="6" height="6" x="60" y="138" style="fill:#000"/><rect width="6" height="6" x="66" y="138" style="fill:#000"/><rect width="6" height="6" x="72" y="138" style="fill:#000"/><rect width="6" height="6" x="78" y="138" style="fill:#000"/><rect width="6" height="6" x="96" y="138" style="fill:#000"/><rect width="6" height="6" x="108" y="138" style="fill:#000"/><rect width="6" height="6" x="114" y="138" style="fill:#000"/><rect width="6" height="6" x="120" y="138" style="fill:#000"/><rect width="6" height="6" x="144" y="138" style="fill:#000"/><rect width="6" height="6" x="150" y="138" style="fill:#000"/><rect width="6" height="6" x="162" y="138" style="fill:#000"/><rect width="6" height="6" x="168" y="138" style="fill:#000"/>
27
+ <rect width="6" height="6" x="0" y="144" style="fill:#000"/><rect width="6" height="6" x="12" y="144" style="fill:#000"/><rect width="6" height="6" x="18" y="144" style="fill:#000"/><rect width="6" height="6" x="24" y="144" style="fill:#000"/><rect width="6" height="6" x="36" y="144" style="fill:#000"/><rect width="6" height="6" x="48" y="144" style="fill:#000"/><rect width="6" height="6" x="54" y="144" style="fill:#000"/><rect width="6" height="6" x="72" y="144" style="fill:#000"/><rect width="6" height="6" x="102" y="144" style="fill:#000"/><rect width="6" height="6" x="108" y="144" style="fill:#000"/><rect width="6" height="6" x="114" y="144" style="fill:#000"/><rect width="6" height="6" x="120" y="144" style="fill:#000"/><rect width="6" height="6" x="126" y="144" style="fill:#000"/><rect width="6" height="6" x="132" y="144" style="fill:#000"/><rect width="6" height="6" x="138" y="144" style="fill:#000"/><rect width="6" height="6" x="144" y="144" style="fill:#000"/><rect width="6" height="6" x="168" y="144" style="fill:#000"/>
28
+ <rect width="6" height="6" x="0" y="150" style="fill:#000"/><rect width="6" height="6" x="12" y="150" style="fill:#000"/><rect width="6" height="6" x="18" y="150" style="fill:#000"/><rect width="6" height="6" x="24" y="150" style="fill:#000"/><rect width="6" height="6" x="36" y="150" style="fill:#000"/><rect width="6" height="6" x="48" y="150" style="fill:#000"/><rect width="6" height="6" x="60" y="150" style="fill:#000"/><rect width="6" height="6" x="66" y="150" style="fill:#000"/><rect width="6" height="6" x="72" y="150" style="fill:#000"/><rect width="6" height="6" x="78" y="150" style="fill:#000"/><rect width="6" height="6" x="84" y="150" style="fill:#000"/><rect width="6" height="6" x="96" y="150" style="fill:#000"/><rect width="6" height="6" x="126" y="150" style="fill:#000"/><rect width="6" height="6" x="138" y="150" style="fill:#000"/><rect width="6" height="6" x="162" y="150" style="fill:#000"/>
29
+ <rect width="6" height="6" x="0" y="156" style="fill:#000"/><rect width="6" height="6" x="12" y="156" style="fill:#000"/><rect width="6" height="6" x="18" y="156" style="fill:#000"/><rect width="6" height="6" x="24" y="156" style="fill:#000"/><rect width="6" height="6" x="36" y="156" style="fill:#000"/><rect width="6" height="6" x="60" y="156" style="fill:#000"/><rect width="6" height="6" x="66" y="156" style="fill:#000"/><rect width="6" height="6" x="72" y="156" style="fill:#000"/><rect width="6" height="6" x="90" y="156" style="fill:#000"/><rect width="6" height="6" x="126" y="156" style="fill:#000"/><rect width="6" height="6" x="144" y="156" style="fill:#000"/><rect width="6" height="6" x="156" y="156" style="fill:#000"/><rect width="6" height="6" x="162" y="156" style="fill:#000"/><rect width="6" height="6" x="168" y="156" style="fill:#000"/>
30
+ <rect width="6" height="6" x="0" y="162" style="fill:#000"/><rect width="6" height="6" x="36" y="162" style="fill:#000"/><rect width="6" height="6" x="54" y="162" style="fill:#000"/><rect width="6" height="6" x="72" y="162" style="fill:#000"/><rect width="6" height="6" x="84" y="162" style="fill:#000"/><rect width="6" height="6" x="114" y="162" style="fill:#000"/><rect width="6" height="6" x="120" y="162" style="fill:#000"/><rect width="6" height="6" x="132" y="162" style="fill:#000"/><rect width="6" height="6" x="144" y="162" style="fill:#000"/><rect width="6" height="6" x="150" y="162" style="fill:#000"/><rect width="6" height="6" x="156" y="162" style="fill:#000"/><rect width="6" height="6" x="168" y="162" style="fill:#000"/>
31
+ <rect width="6" height="6" x="0" y="168" style="fill:#000"/><rect width="6" height="6" x="6" y="168" style="fill:#000"/><rect width="6" height="6" x="12" y="168" style="fill:#000"/><rect width="6" height="6" x="18" y="168" style="fill:#000"/><rect width="6" height="6" x="24" y="168" style="fill:#000"/><rect width="6" height="6" x="30" y="168" style="fill:#000"/><rect width="6" height="6" x="36" y="168" style="fill:#000"/><rect width="6" height="6" x="54" y="168" style="fill:#000"/><rect width="6" height="6" x="84" y="168" style="fill:#000"/><rect width="6" height="6" x="96" y="168" style="fill:#000"/><rect width="6" height="6" x="108" y="168" style="fill:#000"/><rect width="6" height="6" x="120" y="168" style="fill:#000"/><rect width="6" height="6" x="138" y="168" style="fill:#000"/><rect width="6" height="6" x="144" y="168" style="fill:#000"/>
32
+ </svg>
@@ -1,16 +1,8 @@
1
- #!/usr/bin/env ruby
1
+ # frozen_string_literal: true
2
2
 
3
- #--
4
- # Copyright 2008 by Duncan Robertson (duncan@whomwah.com).
5
- # All rights reserved.
6
-
7
- # Permission is granted for use, copying, modification, distribution,
8
- # and distribution of modified versions of this work as long as the
9
- # above copyright notice is included.
10
- #++
11
-
12
- require "rqrcode/core_ext"
13
- require "rqrcode/qrcode"
14
- require 'rqrcode/export/png'
15
- require 'rqrcode/export/svg'
16
- require 'rqrcode/export/html'
3
+ module RQRCode
4
+ require 'rqrcode_core'
5
+ require 'rqrcode/qrcode'
6
+ require 'rqrcode/export'
7
+ require 'rqrcode/version'
8
+ end
@@ -1,9 +1,6 @@
1
- require 'rqrcode'
2
-
3
- require 'minitest/spec'
4
- require 'minitest/autorun'
1
+ # frozen_string_literal: true
5
2
 
3
+ require 'rqrcode/export/ansi'
4
+ require 'rqrcode/export/html'
6
5
  require 'rqrcode/export/png'
7
6
  require 'rqrcode/export/svg'
8
- require 'rqrcode/export/html'
9
-
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RQRCode
4
+ module Export
5
+ module ANSI
6
+ #
7
+ # Returns a string of the QR code as
8
+ # characters writen with ANSI background set.
9
+ #
10
+ # Options:
11
+ # light: Foreground ("\033[47m")
12
+ # dark: Background ANSI code. ("\033[47m")
13
+ # fill_character: The written character. (' ')
14
+ # quiet_zone_size: (4)
15
+ #
16
+ def as_ansi(options={})
17
+ options = {
18
+ light: "\033[47m",
19
+ dark: "\033[40m",
20
+ fill_character: ' ',
21
+ quiet_zone_size: 4
22
+ }.merge(options)
23
+
24
+ normal = "\033[m\n"
25
+ light = options.fetch(:light)
26
+ dark = options.fetch(:dark)
27
+ fill_character = options.fetch(:fill_character)
28
+ quiet_zone_size = options.fetch(:quiet_zone_size)
29
+ output = []
30
+
31
+ @qrcode.modules.each_index do |c|
32
+ # start row with quiet zone
33
+ row = light + fill_character * quiet_zone_size
34
+ previous_dark = false
35
+
36
+ @qrcode.modules.each_index do |r|
37
+ if @qrcode.checked?(c, r)
38
+ if previous_dark != true
39
+ row << dark
40
+ previous_dark = true
41
+ end
42
+ row << fill_character
43
+ else
44
+ # light
45
+ if previous_dark != false
46
+ row << light
47
+ previous_dark = false
48
+ end
49
+ row << fill_character
50
+ end
51
+ end
52
+
53
+ # add quiet zone
54
+ if previous_dark != false
55
+ row << light
56
+ end
57
+ row << fill_character * quiet_zone_size
58
+
59
+ # always end with reset and newline
60
+ row << normal
61
+
62
+ output << row
63
+ end
64
+
65
+ # count the row width so we can add quiet zone rows
66
+ width = output.first.scan(fill_character).length
67
+
68
+ quiet_row = light + fill_character * width + normal
69
+ quiet_rows = quiet_row * quiet_zone_size
70
+
71
+ return quiet_rows + output.join + quiet_rows
72
+ end
73
+ end
74
+ end
75
+ end
76
+
77
+ RQRCode::QRCode.send :include, RQRCode::Export::ANSI
@@ -1,8 +1,10 @@
1
- # Use this module to HTML-ify the QR code if you just want the default HTML
1
+ # frozen_string_literal: true
2
+
2
3
  module RQRCode
3
4
  module Export
4
5
  module HTML
5
-
6
+ #
7
+ # Use this module to HTML-ify the QR code if you just want the default HTML
6
8
  def as_html
7
9
  ['<table>', rows.as_html, '</table>'].join
8
10
  end
@@ -10,7 +12,7 @@ module RQRCode
10
12
  private
11
13
 
12
14
  def rows
13
- Rows.new(self)
15
+ Rows.new(@qrcode)
14
16
  end
15
17
 
16
18
  class Rows < Struct.new(:qr)
@@ -39,11 +41,7 @@ module RQRCode
39
41
  end
40
42
 
41
43
  def html_class
42
- dark? ? 'black' : 'white'
43
- end
44
-
45
- def dark?
46
- qr.dark?(row_index, col_index)
44
+ qr.checked?(row_index, col_index) ? 'black' : 'white'
47
45
  end
48
46
  end
49
47
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'chunky_png'
2
3
 
3
4
  # This class creates PNG files.
@@ -5,21 +6,21 @@ require 'chunky_png'
5
6
  module RQRCode
6
7
  module Export
7
8
  module PNG
8
-
9
+ #
9
10
  # Render the PNG from the Qrcode.
10
11
  #
11
12
  # There are two sizing algoritams.
12
13
  #
13
14
  # - Original that can result in blurry and hard to scan images
14
15
  # - Google's Chart API inspired sizing that resizes the module size to fit within the given image size.
15
- #
16
+ #
16
17
  # The Googleis one will be used when no options are given or when the new size option is used.
17
18
  #
18
- # Options:
19
+ # Options:
19
20
  # fill - Background ChunkyPNG::Color, defaults to 'white'
20
21
  # color - Foreground ChunkyPNG::Color, defaults to 'black'
21
22
  #
22
- # *Googleis*
23
+ # *Googleis*
23
24
  # size - Total size of PNG in pixels. The module size is calculated so it fits. (defaults to 90)
24
25
  # border_modules - Width of white border around in modules. (defaults to 4).
25
26
  #
@@ -33,7 +34,6 @@ module RQRCode
33
34
  # Defaults to 90x90 pixels, customizable by option.
34
35
  #
35
36
  def as_png(options = {})
36
-
37
37
  default_img_options = {
38
38
  :resize_gte_to => false,
39
39
  :resize_exactly_to => false,
@@ -44,26 +44,26 @@ module RQRCode
44
44
  :file => false,
45
45
  :module_px_size => 6
46
46
  }
47
-
47
+
48
48
  googleis = options.length == 0 || (options[:size] != nil)
49
-
49
+
50
50
  options = default_img_options.merge(options) # reverse_merge
51
51
 
52
52
  fill = ChunkyPNG::Color(options[:fill])
53
53
  color = ChunkyPNG::Color(options[:color])
54
54
  output_file = options[:file]
55
-
55
+
56
56
  module_px_size = nil
57
57
  border_px = nil
58
58
  png = nil
59
-
59
+
60
60
  if googleis
61
61
  total_image_size = options[:size]
62
62
  border_modules = options[:border_modules]
63
63
 
64
- module_px_size = (total_image_size.to_f / (self.module_count + 2 * border_modules).to_f).floor.to_i
64
+ module_px_size = (total_image_size.to_f / (@qrcode.module_count + 2 * border_modules).to_f).floor.to_i
65
65
 
66
- img_size = module_px_size * self.module_count
66
+ img_size = module_px_size * @qrcode.module_count
67
67
 
68
68
  remaining = total_image_size - img_size
69
69
  border_px = (remaining / 2.0).floor.to_i
@@ -73,7 +73,7 @@ module RQRCode
73
73
  border = options[:border_modules]
74
74
  total_border = border * 2
75
75
  module_px_size = if options[:resize_gte_to]
76
- (options[:resize_gte_to].to_f / (self.module_count + total_border).to_f).ceil.to_i
76
+ (options[:resize_gte_to].to_f / (@qrcode.module_count + total_border).to_f).ceil.to_i
77
77
  else
78
78
  options[:module_px_size]
79
79
  end
@@ -81,15 +81,15 @@ module RQRCode
81
81
  total_border_px = border_px * 2
82
82
  resize_to = options[:resize_exactly_to]
83
83
 
84
- img_size = module_px_size * self.module_count
84
+ img_size = module_px_size * @qrcode.module_count
85
85
  total_img_size = img_size + total_border_px
86
86
 
87
87
  png = ChunkyPNG::Image.new(total_img_size, total_img_size, fill)
88
88
  end
89
89
 
90
- self.modules.each_index do |x|
91
- self.modules.each_index do |y|
92
- if self.dark?(x, y)
90
+ @qrcode.modules.each_index do |x|
91
+ @qrcode.modules.each_index do |y|
92
+ if @qrcode.checked?(x, y)
93
93
  (0...module_px_size).each do |i|
94
94
  (0...module_px_size).each do |j|
95
95
  png[(y * module_px_size) + border_px + j , (x * module_px_size) + border_px + i] = color
@@ -98,9 +98,9 @@ module RQRCode
98
98
  end
99
99
  end
100
100
  end
101
-
101
+
102
102
  if !googleis && resize_to
103
- png = png.resize(resize_to, resize_to)
103
+ png = png.resize(resize_to, resize_to)
104
104
  end
105
105
 
106
106
 
@@ -109,7 +109,6 @@ module RQRCode
109
109
  end
110
110
  png
111
111
  end
112
-
113
112
  end
114
113
  end
115
114
  end
@@ -1,10 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This class creates a SVG files.
2
4
  # Code from: https://github.com/samvincent/rqrcode-rails3
3
5
  module RQRCode
4
6
  module Export
5
-
6
7
  module SVG
7
-
8
+ #
8
9
  # Render the SVG from the Qrcode.
9
10
  #
10
11
  # Options:
@@ -13,28 +14,31 @@ module RQRCode
13
14
  # color - Foreground color for the code (e.g. "000000" or :black)
14
15
  # module_size - The Pixel size of each module (e.g. 11)
15
16
  # shape_rendering - Defaults to crispEdges
17
+ # standalone - wether to make this a full SVG file, or only svg to embed
18
+ # in other svg.
16
19
  #
17
20
  def as_svg(options={})
18
21
  offset = options[:offset].to_i || 0
19
22
  color = options[:color] || "000"
20
23
  shape_rendering = options[:shape_rendering] || "crispEdges"
21
24
  module_size = options[:module_size] || 11
25
+ standalone = options[:standalone].nil? ? true : options[:standalone]
22
26
 
23
27
  # height and width dependent on offset and QR complexity
24
- dimension = (self.module_count*module_size) + (2*offset)
28
+ dimension = (@qrcode.module_count*module_size) + (2*offset)
25
29
 
26
30
  xml_tag = %{<?xml version="1.0" standalone="yes"?>}
27
31
  open_tag = %{<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="#{dimension}" height="#{dimension}" shape-rendering="#{shape_rendering}">}
28
32
  close_tag = "</svg>"
29
33
 
30
34
  result = []
31
- self.modules.each_index do |c|
35
+ @qrcode.modules.each_index do |c|
32
36
  tmp = []
33
- self.modules.each_index do |r|
37
+ @qrcode.modules.each_index do |r|
34
38
  y = c*module_size + offset
35
39
  x = r*module_size + offset
36
40
 
37
- next unless self.is_dark(c, r)
41
+ next unless @qrcode.checked?(c, r)
38
42
  tmp << %{<rect width="#{module_size}" height="#{module_size}" x="#{x}" y="#{y}" style="fill:##{color}"/>}
39
43
  end
40
44
  result << tmp.join
@@ -44,7 +48,12 @@ module RQRCode
44
48
  result.unshift %{<rect width="#{dimension}" height="#{dimension}" x="0" y="0" style="fill:##{options[:fill]}"/>}
45
49
  end
46
50
 
47
- [xml_tag, open_tag, result, close_tag].flatten.join("\n")
51
+ if standalone
52
+ result.unshift(xml_tag, open_tag)
53
+ result << close_tag
54
+ end
55
+
56
+ result.join("\n")
48
57
  end
49
58
  end
50
59
  end
@@ -1,4 +1,3 @@
1
- Dir[File.dirname(__FILE__) + "/qrcode/*.rb"].sort.each do |path|
2
- filename = File.basename(path)
3
- require "rqrcode/qrcode/#{filename}"
4
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'rqrcode/qrcode/qrcode'
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'forwardable'
4
+
5
+ module RQRCode #:nodoc:
6
+ class QRCode
7
+ extend Forwardable
8
+ def_delegators :@qrcode, :to_s
9
+ def_delegators :@qrcode, :modules # deprecated
10
+
11
+ attr_reader :qrcode
12
+
13
+ def initialize(string, *args)
14
+ @qrcode = RQRCodeCore::QRCode.new(string, *args)
15
+ end
16
+ end
17
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RQRCode
2
- VERSION = "0.8.2"
4
+ VERSION = "1.0.1"
3
5
  end
@@ -1,32 +1,36 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
2
+
3
+ lib = File.expand_path("../lib", __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require "rqrcode/version"
4
6
 
5
- Gem::Specification.new do |s|
6
- s.name = "rqrcode"
7
- s.version = RQRCode::VERSION
8
- s.platform = Gem::Platform::RUBY
9
- s.authors = ["Björn Blomqvist","Duncan Robertson"]
10
- s.email = ["darwin@bits2life.com"]
11
- s.homepage = "https://github.com/whomwah/rqrcode"
12
- s.summary = "A library to encode QR Codes"
13
- s.description = <<EOF
14
- rQRCode is a library for encoding QR Codes. The simple
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "rqrcode"
9
+ spec.version = RQRCode::VERSION
10
+ spec.platform = Gem::Platform::RUBY
11
+ spec.authors = ["Duncan Robertson"]
12
+ spec.email = ["duncan@whomwah.com"]
13
+
14
+ spec.summary = %q{A library to encode QR Codes}
15
+ spec.description = <<EOF
16
+ rqrcode is a library for encoding QR Codes. The simple
15
17
  interface allows you to create QR Code data structures
16
- ready to be displayed in the way you choose.
18
+ and then render them in the way you choose.
17
19
  EOF
20
+ spec.homepage = "https://github.com/whomwah/rqrcode"
21
+ spec.license = "MIT"
18
22
 
19
- s.required_rubygems_version = Gem::Requirement.new('>= 1.3.6')
20
-
21
- s.add_dependency 'chunky_png', "~> 1.0"
22
-
23
- s.add_development_dependency "rake"
24
- s.add_development_dependency("bundler", ">= 1.0.0")
23
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
24
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ end
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
25
29
 
26
- s.has_rdoc = true
27
- s.extra_rdoc_files = ["README.md", "CHANGELOG", "LICENSE"]
28
- s.files = `git ls-files`.split("\n")
29
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
30
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
31
- s.require_paths = ["lib"]
30
+ spec.required_ruby_version = '~> 2.3'
31
+ spec.add_dependency 'rqrcode_core', '~> 0.1.0'
32
+ spec.add_dependency 'chunky_png', "~> 1.0"
33
+ spec.add_development_dependency "bundler", "~> 2.0"
34
+ spec.add_development_dependency "rake", "~> 12.0"
35
+ spec.add_development_dependency "minitest", "~> 5.0"
32
36
  end