rqrcode 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -4
- data/Gemfile.lock +3 -3
- data/README.md +32 -19
- data/lib/rqrcode/version.rb +1 -1
- data/rqrcode.gemspec +4 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e194a5360a135a0ba06a0ea02e0ec9b6aa865e138e60a50176c45e148ed05178
|
4
|
+
data.tar.gz: bcc56e289e6f09f750409c5433d8edfb91808280c88880b99cee377743164f0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b1ae5e3d66ab5de484c0f70dfd21efc683d5708128516c0da28a7aefdbe6be585a2a2c1939e49591fc9a3478f7ef9dfb96da8938871f83ce97bae5077aa0e41
|
7
|
+
data.tar.gz: d5df60860ebe56dae982aad6f01c11cd06fea0e324d543430d6694c663200e3aa48523082cd21af7d48cf229119bc117625cd714f6104975b4e9d8d4eeb7beef
|
data/CHANGELOG.md
CHANGED
@@ -7,13 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [2.1.0] - 2021-08-26
|
11
|
+
|
12
|
+
- Sync Gemfile.lock with `rqrcode_core.1.2.0` [Adds Multimode Support](https://github.com/whomwah/rqrcode_core#multiple-encoding-support)
|
13
|
+
- Add badge for Standard linting
|
14
|
+
|
15
|
+
### Changed
|
16
|
+
|
17
|
+
- Corrected method name referred to in CHANGELOG.
|
18
|
+
|
10
19
|
## [2.0.0] - 2021-05-06
|
11
20
|
|
12
21
|
### Added
|
13
22
|
|
14
|
-
- A new `use_path:` option on `.
|
15
|
-
- A new `viewbox:` option on `.
|
16
|
-
- A new `svg_attributes:` option on `.
|
23
|
+
- A new `use_path:` option on `.as_svg`. This uses a `<path>` node to greatly reduce the final SVG size. [#108]
|
24
|
+
- A new `viewbox:` option on `.as_svg`. Replaces the `svg.width` and `svg.height` attribute with `svg.viewBox` to allow CSS scaling. [#112]
|
25
|
+
- A new `svg_attributes:` option on `.as_svg`. Allows you to pass in custom SVG attributes to be used in the `<svg>` tag. [#113]
|
17
26
|
|
18
27
|
### Changed
|
19
28
|
|
@@ -34,6 +43,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
34
43
|
- bump dependencies
|
35
44
|
- fix `required_ruby_version` for Ruby 3 support
|
36
45
|
|
37
|
-
[unreleased]: https://github.com/whomwah/rqrcode/compare/v2.
|
46
|
+
[unreleased]: https://github.com/whomwah/rqrcode/compare/v2.1.0...HEAD
|
47
|
+
[2.1.0]: https://github.com/whomwah/rqrcode/compare/v2.0.0...v2.1.0
|
38
48
|
[2.0.0]: https://github.com/whomwah/rqrcode/compare/v1.2.0...v2.0.0
|
39
49
|
[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.
|
4
|
+
rqrcode (2.1.0)
|
5
5
|
chunky_png (~> 1.0)
|
6
6
|
rqrcode_core (~> 1.0)
|
7
7
|
|
@@ -18,7 +18,7 @@ GEM
|
|
18
18
|
rake (13.0.3)
|
19
19
|
regexp_parser (2.1.1)
|
20
20
|
rexml (3.2.5)
|
21
|
-
rqrcode_core (1.
|
21
|
+
rqrcode_core (1.2.0)
|
22
22
|
rspec (3.10.0)
|
23
23
|
rspec-core (~> 3.10.0)
|
24
24
|
rspec-expectations (~> 3.10.0)
|
@@ -65,4 +65,4 @@ DEPENDENCIES
|
|
65
65
|
standardrb (~> 1.0)
|
66
66
|
|
67
67
|
BUNDLED WITH
|
68
|
-
2.2.
|
68
|
+
2.2.22
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# RQRCode
|
2
2
|
|
3
3
|
![](https://github.com/whomwah/rqrcode/actions/workflows/ruby.yml/badge.svg)
|
4
|
+
[![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)
|
4
5
|
|
5
6
|
|
6
7
|
[RQRCode](https://github.com/whomwah/rqrcode) is a library for creating and rendering QR codes into various formats. It has a simple interface with all the standard QR code options. It was adapted from the Javascript library by Kazuhiko Arase.
|
@@ -32,6 +33,7 @@ require "rqrcode"
|
|
32
33
|
qr = RQRCode::QRCode.new("https://kyan.com")
|
33
34
|
|
34
35
|
puts qr.to_s
|
36
|
+
# to_s( dark: "x", light: " " ) # defaults
|
35
37
|
|
36
38
|
xxxxxxx xxxxxxx xxx xxxxxxx
|
37
39
|
x x x xxx xx x x
|
@@ -42,32 +44,46 @@ x x xxx x xx x x x x
|
|
42
44
|
...
|
43
45
|
```
|
44
46
|
|
47
|
+
Easy, but unlikely to be readable. For this you will need to use one of the many [rendering options](#render-types) below.
|
48
|
+
|
45
49
|
### Advanced Options
|
46
50
|
|
47
|
-
These are the various QR
|
51
|
+
These are the various QR code generation options provided by the underlying [rqrcode_core](https://github.com/whomwah/rqrcode_core). You may actually only need this library if you don't need the various rendering options `rqrcode` provides, but just need the data structure.
|
48
52
|
|
49
53
|
```
|
50
|
-
string
|
54
|
+
Expects a string or array (for multi-segment encoding) to be parsed in, other args are optional
|
55
|
+
|
56
|
+
data - the string, QRSegment or array of Hashes (with data:, mode: keys) you wish to encode
|
51
57
|
|
52
|
-
size
|
58
|
+
size - the size (Integer) of the QR Code (defaults to smallest size needed to encode the data)
|
53
59
|
|
54
|
-
|
55
|
-
* Level :l 7% of code can be restored
|
56
|
-
* Level :m 15% of code can be restored
|
57
|
-
* Level :q 25% of code can be restored
|
58
|
-
* Level :h 30% of code can be restored (default :h)
|
60
|
+
max_size - the max_size (Integer) of the QR Code (default RQRCodeCore::QRUtil.max_size)
|
59
61
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
62
|
+
level - the error correction level, can be:
|
63
|
+
* Level :l 7% of code can be restored
|
64
|
+
* Level :m 15% of code can be restored
|
65
|
+
* Level :q 25% of code can be restored
|
66
|
+
* Level :h 30% of code can be restored (default :h)
|
67
|
+
|
68
|
+
mode - the mode of the QR Code (defaults to :alphanumeric or :byte_8bit, depending on the input data,
|
69
|
+
only used when data is a string):
|
70
|
+
* :number
|
71
|
+
* :alphanumeric
|
72
|
+
* :byte_8bit
|
73
|
+
* :kanji
|
65
74
|
```
|
66
75
|
|
67
76
|
Example
|
68
77
|
|
69
|
-
```
|
70
|
-
|
78
|
+
```ruby
|
79
|
+
simple_qrcode = RQRCodeCore::QRCode.new("https://kyan.com", size: 1, level: :m, mode: :alphanumeric)
|
80
|
+
|
81
|
+
segment_qrcode = QRCodeCore::QRCode.new({ data: "foo", mode: :byte_8bit })
|
82
|
+
|
83
|
+
multi_qrcode = RQRCodeCore::QRCode.new([
|
84
|
+
{ data: 'foo', mode: :byte_8bit },
|
85
|
+
{ data: 'bar1', mode: :alphanumeric }
|
86
|
+
])
|
71
87
|
```
|
72
88
|
|
73
89
|
## Render types
|
@@ -114,10 +130,7 @@ svg = qrcode.as_svg(
|
|
114
130
|
shape_rendering: "crispEdges",
|
115
131
|
module_size: 11,
|
116
132
|
standalone: true,
|
117
|
-
use_path: true
|
118
|
-
svg_attributes: {
|
119
|
-
id: "myUniqueId"
|
120
|
-
}
|
133
|
+
use_path: true
|
121
134
|
)
|
122
135
|
```
|
123
136
|
|
data/lib/rqrcode/version.rb
CHANGED
data/rqrcode.gemspec
CHANGED
@@ -17,6 +17,10 @@ Gem::Specification.new do |spec|
|
|
17
17
|
EOF
|
18
18
|
spec.homepage = "https://github.com/whomwah/rqrcode"
|
19
19
|
spec.license = "MIT"
|
20
|
+
spec.metadata = {
|
21
|
+
"bug_tracker_uri" => "https://github.com/whomwah/rqrcode/issues",
|
22
|
+
"changelog_uri" => "https://github.com/whomwah/rqrcode/blob/master/CHANGELOG.md"
|
23
|
+
}
|
20
24
|
|
21
25
|
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
22
26
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
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.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Duncan Robertson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rqrcode_core
|
@@ -132,7 +132,9 @@ files:
|
|
132
132
|
homepage: https://github.com/whomwah/rqrcode
|
133
133
|
licenses:
|
134
134
|
- MIT
|
135
|
-
metadata:
|
135
|
+
metadata:
|
136
|
+
bug_tracker_uri: https://github.com/whomwah/rqrcode/issues
|
137
|
+
changelog_uri: https://github.com/whomwah/rqrcode/blob/master/CHANGELOG.md
|
136
138
|
post_install_message:
|
137
139
|
rdoc_options: []
|
138
140
|
require_paths:
|
@@ -148,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
150
|
- !ruby/object:Gem::Version
|
149
151
|
version: '0'
|
150
152
|
requirements: []
|
151
|
-
rubygems_version: 3.2.
|
153
|
+
rubygems_version: 3.2.22
|
152
154
|
signing_key:
|
153
155
|
specification_version: 4
|
154
156
|
summary: A library to encode QR Codes
|