rqrcode 0.9.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ruby.yml +31 -0
  3. data/.gitignore +9 -1
  4. data/.rspec +2 -0
  5. data/Gemfile +3 -8
  6. data/LICENSE.txt +21 -0
  7. data/README.md +125 -122
  8. data/Rakefile +7 -11
  9. data/_config.yml +1 -0
  10. data/bin/console +14 -0
  11. data/bin/setup +8 -0
  12. data/images/ansi-screen-shot.png +0 -0
  13. data/images/github-qrcode.png +0 -0
  14. data/images/github-qrcode.svg +32 -0
  15. data/lib/rqrcode.rb +7 -15
  16. data/lib/rqrcode/export.rb +6 -0
  17. data/lib/rqrcode/export/ansi.rb +77 -0
  18. data/lib/rqrcode/export/html.rb +6 -8
  19. data/lib/rqrcode/export/png.rb +40 -31
  20. data/lib/rqrcode/export/svg.rb +16 -7
  21. data/lib/rqrcode/qrcode.rb +3 -4
  22. data/lib/rqrcode/qrcode/qrcode.rb +17 -0
  23. data/lib/rqrcode/version.rb +3 -1
  24. data/rqrcode.gemspec +28 -24
  25. metadata +67 -59
  26. data/.travis.yml +0 -7
  27. data/CHANGELOG +0 -85
  28. data/LICENSE +0 -19
  29. data/TODO.md +0 -4
  30. data/lib/rqrcode/core_ext.rb +0 -5
  31. data/lib/rqrcode/core_ext/array.rb +0 -5
  32. data/lib/rqrcode/core_ext/array/behavior.rb +0 -12
  33. data/lib/rqrcode/core_ext/integer.rb +0 -5
  34. data/lib/rqrcode/core_ext/integer/bitwise.rb +0 -13
  35. data/lib/rqrcode/qrcode/qr_8bit_byte.rb +0 -36
  36. data/lib/rqrcode/qrcode/qr_alphanumeric.rb +0 -47
  37. data/lib/rqrcode/qrcode/qr_bit_buffer.rb +0 -99
  38. data/lib/rqrcode/qrcode/qr_code.rb +0 -585
  39. data/lib/rqrcode/qrcode/qr_math.rb +0 -63
  40. data/lib/rqrcode/qrcode/qr_numeric.rb +0 -66
  41. data/lib/rqrcode/qrcode/qr_polynomial.rb +0 -78
  42. data/lib/rqrcode/qrcode/qr_rs_block.rb +0 -314
  43. data/lib/rqrcode/qrcode/qr_util.rb +0 -272
  44. data/test/data.rb +0 -23
  45. data/test/test_helper.rb +0 -5
  46. data/test/test_regresions.rb +0 -10
  47. data/test/test_rqrcode.rb +0 -155
  48. data/test/test_rqrcode_export.rb +0 -23
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
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
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rqrcode/export/ansi'
4
+ require 'rqrcode/export/html'
5
+ require 'rqrcode/export/png'
6
+ require 'rqrcode/export/svg'
@@ -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,26 @@ require 'chunky_png'
5
6
  module RQRCode
6
7
  module Export
7
8
  module PNG
8
-
9
- # Render the PNG from the Qrcode.
9
+ # Render the PNG from the QR Code.
10
10
  #
11
11
  # There are two sizing algoritams.
12
12
  #
13
13
  # - Original that can result in blurry and hard to scan images
14
14
  # - Google's Chart API inspired sizing that resizes the module size to fit within the given image size.
15
- #
15
+ #
16
16
  # The Googleis one will be used when no options are given or when the new size option is used.
17
17
  #
18
- # Options:
18
+ # Options:
19
19
  # fill - Background ChunkyPNG::Color, defaults to 'white'
20
20
  # color - Foreground ChunkyPNG::Color, defaults to 'black'
21
21
  #
22
- # *Googleis*
22
+ # When option :file is supplied you can use the following ChunkyPNG constraints
23
+ # color_mode - The color mode to use. Use one of the ChunkyPNG::COLOR_* constants. defaults to 'ChunkyPNG::COLOR_GRAYSCALE'
24
+ # bit_depth - The bit depth to use. This option is only used for indexed images. defaults to '1' bit
25
+ # interlace - Whether to use interlacing (true or false). defaults to ChunkyPNG default
26
+ # compression - The compression level for Zlib. This can be a value between 0 and 9, or a Zlib constant like Zlib::BEST_COMPRESSION, defaults to ChunkyPNG defaults
27
+ #
28
+ # *Googleis*
23
29
  # size - Total size of PNG in pixels. The module size is calculated so it fits. (defaults to 90)
24
30
  # border_modules - Width of white border around in modules. (defaults to 4).
25
31
  #
@@ -33,37 +39,35 @@ module RQRCode
33
39
  # Defaults to 90x90 pixels, customizable by option.
34
40
  #
35
41
  def as_png(options = {})
36
-
37
42
  default_img_options = {
38
- :resize_gte_to => false,
39
- :resize_exactly_to => false,
40
- :fill => 'white',
41
- :color => 'black',
42
- :size => 120,
43
- :border_modules => 4,
44
- :file => false,
45
- :module_px_size => 6
43
+ bit_depth: 1,
44
+ border_modules: 4,
45
+ color_mode: ChunkyPNG::COLOR_GRAYSCALE,
46
+ color: 'black',
47
+ file: false,
48
+ fill: 'white',
49
+ module_px_size: 6,
50
+ resize_exactly_to: false,
51
+ resize_gte_to: false,
52
+ size: 120
46
53
  }
47
-
54
+
48
55
  googleis = options.length == 0 || (options[:size] != nil)
49
-
50
56
  options = default_img_options.merge(options) # reverse_merge
51
-
52
57
  fill = ChunkyPNG::Color(options[:fill])
53
58
  color = ChunkyPNG::Color(options[:color])
54
59
  output_file = options[:file]
55
-
56
60
  module_px_size = nil
57
61
  border_px = nil
58
62
  png = nil
59
-
63
+
60
64
  if googleis
61
65
  total_image_size = options[:size]
62
66
  border_modules = options[:border_modules]
63
67
 
64
- module_px_size = (total_image_size.to_f / (self.module_count + 2 * border_modules).to_f).floor.to_i
68
+ module_px_size = (total_image_size.to_f / (@qrcode.module_count + 2 * border_modules).to_f).floor.to_i
65
69
 
66
- img_size = module_px_size * self.module_count
70
+ img_size = module_px_size * @qrcode.module_count
67
71
 
68
72
  remaining = total_image_size - img_size
69
73
  border_px = (remaining / 2.0).floor.to_i
@@ -73,7 +77,7 @@ module RQRCode
73
77
  border = options[:border_modules]
74
78
  total_border = border * 2
75
79
  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
80
+ (options[:resize_gte_to].to_f / (@qrcode.module_count + total_border).to_f).ceil.to_i
77
81
  else
78
82
  options[:module_px_size]
79
83
  end
@@ -81,15 +85,15 @@ module RQRCode
81
85
  total_border_px = border_px * 2
82
86
  resize_to = options[:resize_exactly_to]
83
87
 
84
- img_size = module_px_size * self.module_count
88
+ img_size = module_px_size * @qrcode.module_count
85
89
  total_img_size = img_size + total_border_px
86
90
 
87
91
  png = ChunkyPNG::Image.new(total_img_size, total_img_size, fill)
88
92
  end
89
93
 
90
- self.modules.each_index do |x|
91
- self.modules.each_index do |y|
92
- if self.dark?(x, y)
94
+ @qrcode.modules.each_index do |x|
95
+ @qrcode.modules.each_index do |y|
96
+ if @qrcode.checked?(x, y)
93
97
  (0...module_px_size).each do |i|
94
98
  (0...module_px_size).each do |j|
95
99
  png[(y * module_px_size) + border_px + j , (x * module_px_size) + border_px + i] = color
@@ -98,18 +102,23 @@ module RQRCode
98
102
  end
99
103
  end
100
104
  end
101
-
105
+
102
106
  if !googleis && resize_to
103
- png = png.resize(resize_to, resize_to)
107
+ png = png.resize(resize_to, resize_to)
104
108
  end
105
109
 
106
-
107
110
  if output_file
108
- png.save(output_file,{ :color_mode => ChunkyPNG::COLOR_GRAYSCALE, :bit_depth =>1})
111
+ constraints = {
112
+ color_mode: options[:color_mode],
113
+ bit_depth: options[:bit_depth]
114
+ }
115
+ constraints[:interlace] = options[:interlace] if options.has_key?(:interlace)
116
+ constraints[:compression] = options[:compression] if options.has_key?(:compression)
117
+ png.save(output_file, constraints)
109
118
  end
119
+
110
120
  png
111
121
  end
112
-
113
122
  end
114
123
  end
115
124
  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.9.0"
4
+ VERSION = "1.1.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 'rspec', '~> 3.5'
32
36
  end