rqrcode 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e194a5360a135a0ba06a0ea02e0ec9b6aa865e138e60a50176c45e148ed05178
4
- data.tar.gz: bcc56e289e6f09f750409c5433d8edfb91808280c88880b99cee377743164f0b
3
+ metadata.gz: 6d9f9771040408819ab4ae97bc5b0de8814863e5b9dba0402268799eb03350d9
4
+ data.tar.gz: 2f811a4fed92cfa3bed1fdbe8609c57910c76184c97eafb00985422d83c02385
5
5
  SHA512:
6
- metadata.gz: 3b1ae5e3d66ab5de484c0f70dfd21efc683d5708128516c0da28a7aefdbe6be585a2a2c1939e49591fc9a3478f7ef9dfb96da8938871f83ce97bae5077aa0e41
7
- data.tar.gz: d5df60860ebe56dae982aad6f01c11cd06fea0e324d543430d6694c663200e3aa48523082cd21af7d48cf229119bc117625cd714f6104975b4e9d8d4eeb7beef
6
+ metadata.gz: 6ece7165b08b181bd62a10069d5b60a849e0887c1c775b625cf691d3f7a439f0a5701d3fa362fb1263d7aae425e9a8a18c706ac621efb7f8f97955f5e7e11dbc
7
+ data.tar.gz: '0479794cb35208cffebf7355cbb3517b394f14b8af04eeebbcf51b2afdafd35f088fe2f9a60daf55752594578231411468f6eef090bd20b4e0c4864ea1cb00e4'
@@ -14,10 +14,10 @@ jobs:
14
14
  fail-fast: false
15
15
  matrix:
16
16
  os: [ubuntu-latest, macos-latest]
17
- ruby: [2.5, 2.6, 2.7, 3.0]
17
+ ruby: [2.5, 2.6, 2.7, '3.0', 3.1]
18
18
  runs-on: ${{ matrix.os }}
19
19
  steps:
20
- - uses: actions/checkout@v1
20
+ - uses: actions/checkout@v2
21
21
  - uses: ruby/setup-ruby@v1
22
22
  with:
23
23
  ruby-version: ${{ matrix.ruby }}
data/CHANGELOG.md CHANGED
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.1.1] - 2022-02-11
11
+
12
+ - Added in a handler for when color arguments are passed in as symbols e.g `color: :yellow`. This also allows for the use of the `:currentColor` keyword. [#122]
13
+
10
14
  ## [2.1.0] - 2021-08-26
11
15
 
12
16
  - Sync Gemfile.lock with `rqrcode_core.1.2.0` [Adds Multimode Support](https://github.com/whomwah/rqrcode_core#multiple-encoding-support)
@@ -43,7 +47,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
43
47
  - bump dependencies
44
48
  - fix `required_ruby_version` for Ruby 3 support
45
49
 
46
- [unreleased]: https://github.com/whomwah/rqrcode/compare/v2.1.0...HEAD
50
+ [unreleased]: https://github.com/whomwah/rqrcode/compare/v2.1.1...HEAD
51
+ [2.1.1]: https://github.com/whomwah/rqrcode/compare/v2.1.0...v2.1.1
47
52
  [2.1.0]: https://github.com/whomwah/rqrcode/compare/v2.0.0...v2.1.0
48
53
  [2.0.0]: https://github.com/whomwah/rqrcode/compare/v1.2.0...v2.0.0
49
54
  [1.2.0]: https://github.com/whomwah/rqrcode/compare/v1.1.1...v1.2.0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rqrcode (2.1.0)
4
+ rqrcode (2.1.1)
5
5
  chunky_png (~> 1.0)
6
6
  rqrcode_core (~> 1.0)
7
7
 
@@ -11,12 +11,12 @@ GEM
11
11
  ast (2.4.2)
12
12
  chunky_png (1.4.0)
13
13
  diff-lcs (1.4.4)
14
- parallel (1.20.1)
15
- parser (3.0.1.0)
14
+ parallel (1.21.0)
15
+ parser (3.1.0.0)
16
16
  ast (~> 2.4.1)
17
17
  rainbow (3.0.0)
18
18
  rake (13.0.3)
19
- regexp_parser (2.1.1)
19
+ regexp_parser (2.2.0)
20
20
  rexml (3.2.5)
21
21
  rqrcode_core (1.2.0)
22
22
  rspec (3.10.0)
@@ -32,27 +32,27 @@ GEM
32
32
  diff-lcs (>= 1.2.0, < 2.0)
33
33
  rspec-support (~> 3.10.0)
34
34
  rspec-support (3.10.2)
35
- rubocop (1.12.1)
35
+ rubocop (1.24.1)
36
36
  parallel (~> 1.10)
37
37
  parser (>= 3.0.0.0)
38
38
  rainbow (>= 2.2.2, < 4.0)
39
39
  regexp_parser (>= 1.8, < 3.0)
40
40
  rexml
41
- rubocop-ast (>= 1.2.0, < 2.0)
41
+ rubocop-ast (>= 1.15.1, < 2.0)
42
42
  ruby-progressbar (~> 1.7)
43
43
  unicode-display_width (>= 1.4.0, < 3.0)
44
- rubocop-ast (1.4.1)
45
- parser (>= 2.7.1.5)
46
- rubocop-performance (1.10.1)
47
- rubocop (>= 0.90.0, < 2.0)
44
+ rubocop-ast (1.15.1)
45
+ parser (>= 3.0.1.1)
46
+ rubocop-performance (1.13.1)
47
+ rubocop (>= 1.7.0, < 2.0)
48
48
  rubocop-ast (>= 0.4.0)
49
49
  ruby-progressbar (1.11.0)
50
- standard (1.0.5)
51
- rubocop (= 1.12.1)
52
- rubocop-performance (= 1.10.1)
50
+ standard (1.6.0)
51
+ rubocop (= 1.24.1)
52
+ rubocop-performance (= 1.13.1)
53
53
  standardrb (1.0.0)
54
54
  standard
55
- unicode-display_width (2.0.0)
55
+ unicode-display_width (2.1.0)
56
56
 
57
57
  PLATFORMS
58
58
  ruby
@@ -65,4 +65,4 @@ DEPENDENCIES
65
65
  standardrb (~> 1.0)
66
66
 
67
67
  BUNDLED WITH
68
- 2.2.22
68
+ 2.2.32
data/README.md CHANGED
@@ -99,9 +99,9 @@ Options:
99
99
 
100
100
  offset - Padding around the QR Code in pixels
101
101
  (default 0)
102
- fill - Background color e.g "ffffff" or :white
102
+ fill - Background color e.g "ffffff" or :white or :currentColor
103
103
  (default none)
104
- color - Foreground color e.g "000" or :black
104
+ color - Foreground color e.g "000" or :black or :currentColor
105
105
  (default "000")
106
106
  module_size - The Pixel size of each module
107
107
  (defaults 11)
@@ -76,12 +76,18 @@ module RQRCode
76
76
  path << edge_loop_string
77
77
  end
78
78
 
79
- @result << %{<path d="#{path.join}" style="fill:##{color}" transform="translate(#{offset},#{offset}) scale(#{module_size})"/>}
79
+ # Prefix hexadecimal colors unless using a named color (symbol)
80
+ color = "##{color}" unless color.is_a?(Symbol)
81
+
82
+ @result << %{<path d="#{path.join}" style="fill:#{color}" transform="translate(#{offset},#{offset}) scale(#{module_size})"/>}
80
83
  end
81
84
  end
82
85
 
83
86
  class Rect < BaseOutputSVG
84
87
  def build(module_size, offset, color)
88
+ # Prefix hexadecimal colors unless using a named color (symbol)
89
+ color = "##{color}" unless color.is_a?(Symbol)
90
+
85
91
  @qrcode.modules.each_index do |c|
86
92
  tmp = []
87
93
  @qrcode.modules.each_index do |r|
@@ -89,7 +95,7 @@ module RQRCode
89
95
  x = r * module_size + offset
90
96
 
91
97
  next unless @qrcode.checked?(c, r)
92
- tmp << %(<rect width="#{module_size}" height="#{module_size}" x="#{x}" y="#{y}" style="fill:##{color}"/>)
98
+ tmp << %(<rect width="#{module_size}" height="#{module_size}" x="#{x}" y="#{y}" style="fill:#{color}"/>)
93
99
  end
94
100
 
95
101
  @result << tmp.join
@@ -184,7 +190,9 @@ module RQRCode
184
190
  output_tag.build(module_size, offset, color)
185
191
 
186
192
  if fill
187
- output_tag.result.unshift %(<rect width="#{dimension}" height="#{dimension}" x="0" y="0" style="fill:##{fill}"/>)
193
+ # Prefix hexadecimal colors unless using a named color (symbol)
194
+ fill = "##{fill}" unless fill.is_a?(Symbol)
195
+ output_tag.result.unshift %(<rect width="#{dimension}" height="#{dimension}" x="0" y="0" style="fill:#{fill}"/>)
188
196
  end
189
197
 
190
198
  if standalone
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "forwardable"
4
4
 
5
- module RQRCode #:nodoc:
5
+ module RQRCode # :nodoc:
6
6
  class QRCode
7
7
  extend Forwardable
8
8
  def_delegators :@qrcode, :to_s
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RQRCode
4
- VERSION = "2.1.0"
4
+ VERSION = "2.1.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rqrcode
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Duncan Robertson
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-26 00:00:00.000000000 Z
11
+ date: 2022-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rqrcode_core
@@ -135,7 +135,7 @@ licenses:
135
135
  metadata:
136
136
  bug_tracker_uri: https://github.com/whomwah/rqrcode/issues
137
137
  changelog_uri: https://github.com/whomwah/rqrcode/blob/master/CHANGELOG.md
138
- post_install_message:
138
+ post_install_message:
139
139
  rdoc_options: []
140
140
  require_paths:
141
141
  - lib
@@ -150,8 +150,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  - !ruby/object:Gem::Version
151
151
  version: '0'
152
152
  requirements: []
153
- rubygems_version: 3.2.22
154
- signing_key:
153
+ rubygems_version: 3.3.3
154
+ signing_key:
155
155
  specification_version: 4
156
156
  summary: A library to encode QR Codes
157
157
  test_files: []