rqrcode 1.0.0.pre → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +20 -0
- data/README.md +5 -5
- data/lib/rqrcode/export/svg.rb +9 -1
- data/lib/rqrcode/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5aa4c4868eb5c584254a66743407f0461a05be74aece89350d41ea79671bc7d0
|
4
|
+
data.tar.gz: eb6bbae7b8449b5a3a60ed5faa4d80a99c9bff2ff09b081a38fcac3bed55046c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5c67b502684055b820a1c4d6aa7be65370c493a5431fcb87c9b859486cf9d584806ceffedbeeff50b41c3d524cf8aa02dda535674c33838bbd0943292f26666
|
7
|
+
data.tar.gz: 1f5295a6b53acea72b83b869666ec004d4bbec494603ee59f7b6ab46401af0bf669c06f9957737c7558e1837c335b3b8da231e28fa18fc167ce6747cc2e1d7d5
|
@@ -0,0 +1,20 @@
|
|
1
|
+
name: rqrcode
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
|
10
|
+
steps:
|
11
|
+
- uses: actions/checkout@v1
|
12
|
+
- name: Set up Ruby 2.6
|
13
|
+
uses: actions/setup-ruby@v1
|
14
|
+
with:
|
15
|
+
ruby-version: 2.6.x
|
16
|
+
- name: Build and test with Rake
|
17
|
+
run: |
|
18
|
+
gem install bundler
|
19
|
+
bundle install --jobs 4 --retry 3
|
20
|
+
bundle exec rake test
|
data/README.md
CHANGED
@@ -1,13 +1,12 @@
|
|
1
|
-
__UPDATE:__ A new pre-release has been made [v1.0.0.pre](https://github.com/whomwah/rqrcode/releases/tag/v1.0.0.pre). A fresh start after a _long_ pause. There is actually no new functionality in the release but there are some dependency changes. Minimum Ruby version is now `~> 2.3`. This release also cleans up the internals a bit. The core `QR Code` generation has been extracted into a new [rqrcode_core](https://github.com/whomwah/rqrcode_core) gem. This enables `qrqcode` to concentrate on rendering. Once `v1.0.0.pre` has had time for people to try I'll release `v1.0.0` of `rqrcode` and then concentrate on working through issues and PRs although I appreciate many of these may be old and out of date now! You can install this pre-release with `gem install rqrcode --pre` or `gem 'rqrcode', '>= 1.0.0.pre'` in your `Gemfile`.
|
2
|
-
|
3
|
-
|
4
1
|
# RQRCode
|
5
2
|
|
6
|
-
|
3
|
+

|
4
|
+
|
7
5
|
|
8
6
|
[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.
|
9
7
|
|
10
8
|
* QR code is trademarked by Denso Wave inc
|
9
|
+
* Minimum Ruby version is `~> 2.3`
|
11
10
|
* For `rqrcode` releases `< 1.0.0` please use [this README](https://github.com/whomwah/rqrcode/blob/cd2732a68434e6197c219e6c8cbdadfce0c4c4f3/README.md)
|
12
11
|
|
13
12
|
## Installing
|
@@ -89,7 +88,8 @@ svg = qrcode.as_svg(
|
|
89
88
|
offset: 0,
|
90
89
|
color: '000',
|
91
90
|
shape_rendering: 'crispEdges',
|
92
|
-
module_size: 6
|
91
|
+
module_size: 6,
|
92
|
+
standalone: true
|
93
93
|
)
|
94
94
|
```
|
95
95
|
|
data/lib/rqrcode/export/svg.rb
CHANGED
@@ -14,12 +14,15 @@ module RQRCode
|
|
14
14
|
# color - Foreground color for the code (e.g. "000000" or :black)
|
15
15
|
# module_size - The Pixel size of each module (e.g. 11)
|
16
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.
|
17
19
|
#
|
18
20
|
def as_svg(options={})
|
19
21
|
offset = options[:offset].to_i || 0
|
20
22
|
color = options[:color] || "000"
|
21
23
|
shape_rendering = options[:shape_rendering] || "crispEdges"
|
22
24
|
module_size = options[:module_size] || 11
|
25
|
+
standalone = options[:standalone].nil? ? true : options[:standalone]
|
23
26
|
|
24
27
|
# height and width dependent on offset and QR complexity
|
25
28
|
dimension = (@qrcode.module_count*module_size) + (2*offset)
|
@@ -45,7 +48,12 @@ module RQRCode
|
|
45
48
|
result.unshift %{<rect width="#{dimension}" height="#{dimension}" x="0" y="0" style="fill:##{options[:fill]}"/>}
|
46
49
|
end
|
47
50
|
|
48
|
-
|
51
|
+
if standalone
|
52
|
+
result.unshift(xml_tag, open_tag)
|
53
|
+
result << close_tag
|
54
|
+
end
|
55
|
+
|
56
|
+
result.join("\n")
|
49
57
|
end
|
50
58
|
end
|
51
59
|
end
|
data/lib/rqrcode/version.rb
CHANGED
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: 1.0.0
|
4
|
+
version: 1.0.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: 2019-
|
11
|
+
date: 2019-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rqrcode_core
|
@@ -90,6 +90,7 @@ executables: []
|
|
90
90
|
extensions: []
|
91
91
|
extra_rdoc_files: []
|
92
92
|
files:
|
93
|
+
- ".github/workflows/ruby.yml"
|
93
94
|
- ".gitignore"
|
94
95
|
- Gemfile
|
95
96
|
- LICENSE.txt
|
@@ -126,11 +127,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
126
127
|
version: '2.3'
|
127
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
129
|
requirements:
|
129
|
-
- - "
|
130
|
+
- - ">="
|
130
131
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
132
|
+
version: '0'
|
132
133
|
requirements: []
|
133
|
-
rubygems_version: 3.0.
|
134
|
+
rubygems_version: 3.0.1
|
134
135
|
signing_key:
|
135
136
|
specification_version: 4
|
136
137
|
summary: A library to encode QR Codes
|