prawn-qr 0.0.1 → 0.0.2

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.
@@ -0,0 +1,2 @@
1
+ rvm:
2
+ - 1.9.3
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # prawn-qr
1
+ # prawn-qr [![Build Status](https://secure.travis-ci.org/josepjaume/prawn-qr.png)](http://travis-ci.org/josepjaume/prawn-qr)
2
2
 
3
3
  Prawn-qr is a prawn extension for creating QR Codes inside of a prawn document thanks to [rqrcode](https://github.com/whomwah/rqrcode).
4
4
 
@@ -24,14 +24,24 @@ module Prawn
24
24
  end
25
25
 
26
26
  def draw
27
+ document.fill_color 'ffffff'
28
+ document.rectangle(
29
+ [horizontal_offset, vertical_offset + table_size],
30
+ table_size, table_size
31
+ )
32
+ document.fill
33
+
27
34
  qrcode.reverse.each_with_index do |row, y|
28
35
  y += 1
29
36
  row.each_with_index do |dark, x|
30
- document.fill_color = (dark ? '000000' : 'ffffff')
31
- document.fill_rectangle(
32
- [x * cell_size + horizontal_offset, y * cell_size + vertical_offset],
33
- cell_size, cell_size
34
- )
37
+ if dark
38
+ document.fill_color = '000000'
39
+ document.rectangle(
40
+ [x * cell_size + horizontal_offset, y * cell_size + vertical_offset],
41
+ cell_size, cell_size
42
+ )
43
+ document.fill
44
+ end
35
45
  end
36
46
  end
37
47
  end
@@ -44,15 +54,17 @@ module Prawn
44
54
 
45
55
  def cell_height
46
56
  return @cell_height if @cell_height
47
- qr = qrcode
48
- height = qr.length
57
+ height = qrcode.length
49
58
  @cell_height = document.bounds.height.to_f / height.to_f
50
59
  end
51
60
 
61
+ def table_size
62
+ cell_size * qrcode.length
63
+ end
64
+
52
65
  def cell_width
53
66
  return @cell_width if @cell_width
54
- qr = qrcode
55
- width = qr.first.length
67
+ width = qrcode.first.length
56
68
  @cell_width = document.bounds.width.to_f / width.to_f
57
69
  end
58
70
 
@@ -1,5 +1,5 @@
1
1
  module Prawn
2
2
  module Qr
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -20,4 +20,5 @@ Gem::Specification.new do |gem|
20
20
  gem.add_development_dependency 'qrio'
21
21
  gem.add_development_dependency 'mini_magick'
22
22
  gem.add_development_dependency 'mocha'
23
+ gem.add_development_dependency 'rake'
23
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prawn-qr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -91,6 +91,22 @@ dependencies:
91
91
  - - ! '>='
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: rake
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
94
110
  description: Prawn-qr is a prawn extension for creating QR Codes inside of a prawn
95
111
  document
96
112
  email:
@@ -100,6 +116,7 @@ extensions: []
100
116
  extra_rdoc_files: []
101
117
  files:
102
118
  - .gitignore
119
+ - .travis.yml
103
120
  - Gemfile
104
121
  - Guardfile
105
122
  - LICENSE