prawn-qrcode 0.5.1 → 0.5.2

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: 403a8097100459aace10f31ef7ebf8177ae029fb60befc009b3823e7fefd4a26
4
- data.tar.gz: dd509b0a317be8c44046dd1b41baf48940a865c036091c41afdf5aa5ea31af3c
3
+ metadata.gz: 3587fc7dbd82b33c463d766acd6d5d66615c6fc4b8366c9bd454dd0e2bc19de3
4
+ data.tar.gz: b2ef597a09d3f33060ed1cc329f8feebf52f22d35882760acf2f9cada65cc47b
5
5
  SHA512:
6
- metadata.gz: 3d2a32073bba4469b6f2cb36e49a6290dfbd78db6bb1cc12ad162a6a592ddb8106c18ff8122649dd3c548d289ab4efafb1148ddc871a834a14a6d87590f50ea2
7
- data.tar.gz: a44e5b92656d8a83785b828187ce6b8e5389255dc4d8ae400d09d43f71909bd44dee348316163e1218714d4d041d77456a99d29f4b5ac6348c9dd8067c34f4db
6
+ metadata.gz: e64c1e7436259d33b6dd0949693946fbc785b114169c0cb8412f180ae99fc2bb742f58db46ee7b202e4ef534c074b192d858609c0da048dbaba6a8ba5d65b637
7
+ data.tar.gz: 0147b627f63876d455cf7e683c8efee880ab018a1c28db9740df7ace419aabc56502030d58992d1fd23d72e2b44d75bb0a18997d51b038f1664a5dc2e4a95ff5
@@ -166,11 +166,11 @@ module Prawn
166
166
  rlim = bounding_box.right
167
167
  case @align
168
168
  when :center
169
- @point[0] = (rlim / 2) - (extent / 2)
169
+ @pos[0] = (rlim / 2) - (extent / 2)
170
170
  when :right
171
- @point[0] = rlim - extent
171
+ @pos[0] = rlim - extent
172
172
  when :left
173
- @point[0] = 0
173
+ @pos[0] = 0
174
174
  end
175
175
  end
176
176
 
@@ -178,6 +178,9 @@ module Prawn
178
178
  def render(pdf)
179
179
  pdf.fill_color background_color
180
180
 
181
+ pos(pdf) # make sure the @pos attribute is set before calling align
182
+ align(pdf.bounds)
183
+
181
184
  pdf.bounding_box(pos(pdf), width: extent, height: extent) do |_box|
182
185
  pdf.fill_color foreground_color
183
186
  margin_dist = margin * dot
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Prawn
18
18
  module QRCode
19
- VERSION = '0.5.1'.freeze
19
+ VERSION = '0.5.2'.freeze
20
20
  end
21
21
  end
@@ -46,5 +46,5 @@ END_DESC
46
46
  spec.add_development_dependency 'minitest', '~> 5.12', '>= 5.12.2'
47
47
  spec.add_development_dependency 'prawn-table', '~> 0.2.2'
48
48
  spec.add_development_dependency 'rake', '~> 13.0'
49
- spec.add_development_dependency 'rubocop', '~>0.76.0'
49
+ spec.add_development_dependency 'rubocop', '~> 0.85.1'
50
50
  end
@@ -7,4 +7,12 @@ class TestQrcodeInContext < Minitest::Test
7
7
  context = Prawn::Document.new
8
8
  assert(context.print_qr_code('HELOWORLD', margin: 0))
9
9
  end
10
+ def test_render_with_alignment
11
+ context = Prawn::Document.new
12
+ left = context.print_qr_code('HELLOWORLD', align: :left)
13
+ center = context.print_qr_code('HELLOWORLD', align: :center)
14
+ right = context.print_qr_code('HELLOWORLD', align: :right)
15
+ assert(left.anchor[0] < center.anchor[0])
16
+ assert(center.anchor[0] < right.anchor[0])
17
+ end
10
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prawn-qrcode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Hausherr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-05 00:00:00.000000000 Z
11
+ date: 2020-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: prawn
@@ -106,14 +106,14 @@ dependencies:
106
106
  requirements:
107
107
  - - "~>"
108
108
  - !ruby/object:Gem::Version
109
- version: 0.76.0
109
+ version: 0.85.1
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
- version: 0.76.0
116
+ version: 0.85.1
117
117
  description: " Prawn/QRCode simplifies the generation and rendering of QRCodes in
118
118
  Prawn PDF documents.\n"
119
119
  email:
@@ -162,7 +162,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
162
  - !ruby/object:Gem::Version
163
163
  version: 1.3.6
164
164
  requirements: []
165
- rubygems_version: 3.0.6
165
+ rubyforge_project:
166
+ rubygems_version: 2.7.7
166
167
  signing_key:
167
168
  specification_version: 4
168
169
  summary: Print QR Codes in PDF