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
metadata CHANGED
@@ -1,107 +1,121 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rqrcode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
- - Björn Blomqvist
8
7
  - Duncan Robertson
9
8
  autorequire:
10
- bindir: bin
9
+ bindir: exe
11
10
  cert_chain: []
12
- date: 2016-01-03 00:00:00.000000000 Z
11
+ date: 2019-09-19 00:00:00.000000000 Z
13
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rqrcode_core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.1.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.1.0
14
27
  - !ruby/object:Gem::Dependency
15
28
  name: chunky_png
16
29
  requirement: !ruby/object:Gem::Requirement
17
30
  requirements:
18
- - - ~>
31
+ - - "~>"
19
32
  - !ruby/object:Gem::Version
20
33
  version: '1.0'
21
34
  type: :runtime
22
35
  prerelease: false
23
36
  version_requirements: !ruby/object:Gem::Requirement
24
37
  requirements:
25
- - - ~>
38
+ - - "~>"
26
39
  - !ruby/object:Gem::Version
27
40
  version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.0'
28
55
  - !ruby/object:Gem::Dependency
29
56
  name: rake
30
57
  requirement: !ruby/object:Gem::Requirement
31
58
  requirements:
32
- - - '>='
59
+ - - "~>"
33
60
  - !ruby/object:Gem::Version
34
- version: '0'
61
+ version: '12.0'
35
62
  type: :development
36
63
  prerelease: false
37
64
  version_requirements: !ruby/object:Gem::Requirement
38
65
  requirements:
39
- - - '>='
66
+ - - "~>"
40
67
  - !ruby/object:Gem::Version
41
- version: '0'
68
+ version: '12.0'
42
69
  - !ruby/object:Gem::Dependency
43
- name: bundler
70
+ name: rspec
44
71
  requirement: !ruby/object:Gem::Requirement
45
72
  requirements:
46
- - - '>='
73
+ - - "~>"
47
74
  - !ruby/object:Gem::Version
48
- version: 1.0.0
75
+ version: '3.5'
49
76
  type: :development
50
77
  prerelease: false
51
78
  version_requirements: !ruby/object:Gem::Requirement
52
79
  requirements:
53
- - - '>='
80
+ - - "~>"
54
81
  - !ruby/object:Gem::Version
55
- version: 1.0.0
82
+ version: '3.5'
56
83
  description: |
57
- rQRCode is a library for encoding QR Codes. The simple
84
+ rqrcode is a library for encoding QR Codes. The simple
58
85
  interface allows you to create QR Code data structures
59
- ready to be displayed in the way you choose.
86
+ and then render them in the way you choose.
60
87
  email:
61
- - darwin@bits2life.com
88
+ - duncan@whomwah.com
62
89
  executables: []
63
90
  extensions: []
64
- extra_rdoc_files:
65
- - README.md
66
- - CHANGELOG
67
- - LICENSE
91
+ extra_rdoc_files: []
68
92
  files:
69
- - .gitignore
70
- - .travis.yml
71
- - CHANGELOG
93
+ - ".github/workflows/ruby.yml"
94
+ - ".gitignore"
95
+ - ".rspec"
72
96
  - Gemfile
73
- - LICENSE
97
+ - LICENSE.txt
74
98
  - README.md
75
99
  - Rakefile
76
- - TODO.md
100
+ - _config.yml
101
+ - bin/console
102
+ - bin/setup
103
+ - images/ansi-screen-shot.png
104
+ - images/github-qrcode.png
105
+ - images/github-qrcode.svg
77
106
  - lib/rqrcode.rb
78
- - lib/rqrcode/core_ext.rb
79
- - lib/rqrcode/core_ext/array.rb
80
- - lib/rqrcode/core_ext/array/behavior.rb
81
- - lib/rqrcode/core_ext/integer.rb
82
- - lib/rqrcode/core_ext/integer/bitwise.rb
107
+ - lib/rqrcode/export.rb
108
+ - lib/rqrcode/export/ansi.rb
83
109
  - lib/rqrcode/export/html.rb
84
110
  - lib/rqrcode/export/png.rb
85
111
  - lib/rqrcode/export/svg.rb
86
112
  - lib/rqrcode/qrcode.rb
87
- - lib/rqrcode/qrcode/qr_8bit_byte.rb
88
- - lib/rqrcode/qrcode/qr_alphanumeric.rb
89
- - lib/rqrcode/qrcode/qr_bit_buffer.rb
90
- - lib/rqrcode/qrcode/qr_code.rb
91
- - lib/rqrcode/qrcode/qr_math.rb
92
- - lib/rqrcode/qrcode/qr_numeric.rb
93
- - lib/rqrcode/qrcode/qr_polynomial.rb
94
- - lib/rqrcode/qrcode/qr_rs_block.rb
95
- - lib/rqrcode/qrcode/qr_util.rb
113
+ - lib/rqrcode/qrcode/qrcode.rb
96
114
  - lib/rqrcode/version.rb
97
115
  - rqrcode.gemspec
98
- - test/data.rb
99
- - test/test_helper.rb
100
- - test/test_regresions.rb
101
- - test/test_rqrcode.rb
102
- - test/test_rqrcode_export.rb
103
116
  homepage: https://github.com/whomwah/rqrcode
104
- licenses: []
117
+ licenses:
118
+ - MIT
105
119
  metadata: {}
106
120
  post_install_message:
107
121
  rdoc_options: []
@@ -109,23 +123,17 @@ require_paths:
109
123
  - lib
110
124
  required_ruby_version: !ruby/object:Gem::Requirement
111
125
  requirements:
112
- - - '>='
126
+ - - "~>"
113
127
  - !ruby/object:Gem::Version
114
- version: '0'
128
+ version: '2.3'
115
129
  required_rubygems_version: !ruby/object:Gem::Requirement
116
130
  requirements:
117
- - - '>='
131
+ - - ">="
118
132
  - !ruby/object:Gem::Version
119
- version: 1.3.6
133
+ version: '0'
120
134
  requirements: []
121
- rubyforge_project:
122
- rubygems_version: 2.4.8
135
+ rubygems_version: 3.0.1
123
136
  signing_key:
124
137
  specification_version: 4
125
138
  summary: A library to encode QR Codes
126
- test_files:
127
- - test/data.rb
128
- - test/test_helper.rb
129
- - test/test_regresions.rb
130
- - test/test_rqrcode.rb
131
- - test/test_rqrcode_export.rb
139
+ test_files: []
@@ -1,7 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2.3
4
- - 2.1.6
5
- - 2.0.0
6
- - 1.9.3
7
- - jruby-19mode
data/CHANGELOG DELETED
@@ -1,85 +0,0 @@
1
- *0.9.0* (Jan 3, 2016)
2
-
3
- - Added support for auto selecting qrcode size up to level 40. (only worked up to level 10 before)
4
- - Added numeric support during auto selection of qrcode mode.
5
-
6
- *0.8.1* (Jan 3, 2016)
7
-
8
- - Remove active support specific `present?`.
9
- - Fix so that all tests are run.
10
-
11
- *0.8.0* (Dec 18, 2015)
12
-
13
- - Added numeric QR code support
14
- - Dropped Ruby v1.8 support
15
-
16
- *0.7.0* (Aug 15, 2015)
17
-
18
- - Added shape_rendering option for as_svg
19
-
20
- *0.6.0* (Jun 2, 2015)
21
-
22
- - Improved png rendering. Previous png rendering could result in hard to scan qrcodes.
23
- *Big thanks to Bart Jedrocha*
24
-
25
- *0.5.5* (Apr 25, 2015)
26
-
27
- - Fixed major bug. The rs block data was missing resulting in qr codes failing to be generated.
28
- *Upgrade highly recomended!!*
29
-
30
- *0.5.4* (Nov 11th, 2013)
31
-
32
- * Added as_html, Big thanks to Jon Evans!
33
-
34
- *0.4.2* (Sep 1st, 2011)
35
-
36
- * Proper namespace CoreExtensions and only extend when needed [https://github.com/metaskills]
37
- * fix for running tests on 1.9
38
-
39
- *0.4.1* (Aug 16th, 2011)
40
-
41
- * Compute common patterns only once (5% to 10% speedup) [https://github.com/gioele]
42
-
43
- *0.4.0* (Aug 13th, 2011)
44
-
45
- * Code optimization: 30% speedup [https://github.com/gioele]
46
- * refactor gem layout
47
-
48
- *0.3.4* (May 23rd, 2011)
49
-
50
- * add the more Rubyish QRCode#dark? alias for #is_dark [https://github.com/dasch]
51
-
52
- *0.3.3* (Feb 1st, 2011)
53
-
54
- * check to see if the level is valid
55
- * fix for 'rszf' bug by [Rob la Lau https://github.com/ohreally]
56
-
57
- *0.3.2* (Mar 15th, 2009)
58
-
59
- * Ruby 1.9 fixes by [Tore Darell http://tore.darell.no] [Chris Mowforth http://blog.99th.st]
60
-
61
- *0.3.1* (Nov 24th, 2008)
62
-
63
- * expanded RS block table to QRcode version 40 [Vladislav Gorodetskiy]
64
-
65
- *0.3.0* (Feb 28th, 2008)
66
-
67
- * added more documentation
68
- * changed to_console to to_s (what was I thinking)
69
- * add more tests
70
-
71
- *0.2.1* (Feb 24th, 2008)
72
-
73
- * small changes to rakefile and readme
74
- * small change to to_console method
75
- * make console_count method private (use modules.size instead)
76
- * slowy updating rdocs
77
-
78
- *0.2.0* (Feb 23rd, 2008)
79
-
80
- * Split files up [DR]
81
- * added rdoc comment ... more to do there
82
-
83
- *0.1.0* (Feb 22rd, 2008)
84
-
85
- * Initial Release [DR]
data/LICENSE DELETED
@@ -1,19 +0,0 @@
1
- Copyright (c) 2008 Duncan Robertson
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to
5
- deal in the Software without restriction, including without limitation the
6
- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
- sell copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in
11
- all copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
- THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
-
data/TODO.md DELETED
@@ -1,4 +0,0 @@
1
- - Add to_ansi rendering_
2
- - Add Kanji mode
3
- - Add ECI Mode
4
- - Improved performance for large QR codes
@@ -1,5 +0,0 @@
1
- Dir[File.dirname(__FILE__) + "/core_ext/*.rb"].sort.each do |path|
2
- filename = File.basename(path)
3
- require "rqrcode/core_ext/#{filename}"
4
- end
5
-
@@ -1,5 +0,0 @@
1
- require 'rqrcode/core_ext/array/behavior'
2
-
3
- class Array #:nodoc:
4
- include RQRCode::CoreExtensions::Array::Behavior
5
- end
@@ -1,12 +0,0 @@
1
- module RQRCode
2
- module CoreExtensions #:nodoc:
3
- module Array #:nodoc:
4
- module Behavior
5
- def extract_options!
6
- last.is_a?(::Hash) ? pop : {}
7
- end unless [].respond_to?(:extract_options!)
8
- end
9
- end
10
- end
11
- end
12
-
@@ -1,5 +0,0 @@
1
- require 'rqrcode/core_ext/integer/bitwise'
2
-
3
- class Integer #:nodoc:
4
- include RQRCode::CoreExtensions::Integer::Bitwise
5
- end
@@ -1,13 +0,0 @@
1
- module RQRCode
2
- module CoreExtensions #:nodoc:
3
- module Integer #:nodoc:
4
- module Bitwise
5
- def rszf(count)
6
- # zero fill right shift
7
- (self >> count) & ((2 ** ((self.size * 8) - count))-1)
8
- end
9
- end
10
- end
11
- end
12
- end
13
-
@@ -1,36 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- #--
4
- # Copyright 2004 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
- module RQRCode
13
-
14
- class QR8bitByte
15
- attr_reader :mode
16
-
17
- def initialize( data )
18
- @mode = QRMODE[:mode_8bit_byte]
19
- @data = data;
20
- end
21
-
22
-
23
- def get_length
24
- @data.bytesize
25
- end
26
-
27
-
28
- def write( buffer)
29
- buffer.byte_encoding_start(get_length)
30
- @data.each_byte do |b|
31
- buffer.put(b, 8)
32
- end
33
- end
34
- end
35
-
36
- end
@@ -1,47 +0,0 @@
1
- module RQRCode
2
-
3
- ALPHANUMERIC = ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',' ','$','%','*','+','-','.','/',':']
4
-
5
- class QRAlphanumeric
6
- attr_reader :mode
7
-
8
- def initialize( data )
9
- @mode = QRMODE[:mode_alpha_numk]
10
-
11
- raise QRCodeArgumentError, "Not a alpha numeric uppercase string `#{data}`" unless QRAlphanumeric.valid_data?(data)
12
-
13
- @data = data;
14
- end
15
-
16
-
17
- def get_length
18
- @data.size
19
- end
20
-
21
- def self.valid_data? data
22
- data.each_char do |s|
23
- return false if ALPHANUMERIC.index(s).nil?
24
- end
25
- true
26
- end
27
-
28
-
29
- def write( buffer)
30
- buffer.alphanumeric_encoding_start(get_length)
31
-
32
- (@data.size).times do |i|
33
- if i % 2 == 0
34
- if i == (@data.size - 1)
35
- value = ALPHANUMERIC.index(@data[i])
36
- buffer.put( value, 6 )
37
- else
38
- value = (ALPHANUMERIC.index(@data[i]) * 45) + ALPHANUMERIC.index(@data[i+1])
39
- buffer.put( value, 11 )
40
- end
41
- end
42
- end
43
-
44
-
45
- end
46
- end
47
- end