rqrcode-with-patches 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # rQRCode, Encode QRCodes
2
2
 
3
3
  I have republished this gem as rqrcode-with-patches as Duncan seams to have abandoned the project.
4
+ You can find the original project here: http://github.com/whomwah/rqrcode
4
5
 
5
6
  ## Overview
6
7
 
@@ -23,11 +24,11 @@ Let's clear up some rQRCode stuff.
23
24
 
24
25
  You may get the latest stable version from Rubygems.
25
26
 
26
- gem install rqrcode
27
+ gem install rqrcode-with-patches
27
28
 
28
- You can also get the latest source from http://github.com/whomwah/rqrcode
29
+ You can also get the latest source from https://github.com/bjornblomqvist/rqrcode
29
30
 
30
- git clone git://github.com/whomwah/rqrcode.git
31
+ git clone git://github.com/bjornblomqvist/rqrcode.git
31
32
 
32
33
  ## Tests
33
34
 
@@ -123,6 +124,13 @@ Exporters support these options:
123
124
  * fill - Background color, defaults to 'white'
124
125
  * color - Foreground color, defaults to 'black'
125
126
 
127
+ SVG Export supports the parameter `module_size` to generate smaller or larger QR Codes
128
+
129
+ ```ruby
130
+ require 'rqrcode/export/svg'
131
+ svg = RQRCode::QRCode.new("nice qr").as_svg(:module_size => 6)
132
+ ```
133
+
126
134
  ## Authors
127
135
 
128
136
  Original author: Duncan Robertson
@@ -9,13 +9,15 @@ module RQRCode
9
9
  # offset - Padding around the QR Code (e.g. 10)
10
10
  # fill - Background color (e.g "ffffff" or :white)
11
11
  # color - Foreground color for the code (e.g. "000000" or :black)
12
+ # module_size - The Pixel size of each module (e.g. 11)
12
13
  module SVG
13
14
  def as_svg(options={})
14
15
  offset = options[:offset].to_i || 0
15
16
  color = options[:color] || "000"
17
+ module_size = options[:module_size] || 11
16
18
 
17
19
  # height and width dependent on offset and QR complexity
18
- dimension = (self.module_count*11) + (2*offset)
20
+ dimension = (self.module_count*module_size) + (2*offset)
19
21
 
20
22
  xml_tag = %{<?xml version="1.0" standalone="yes"?>}
21
23
  open_tag = %{<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events" width="#{dimension}" height="#{dimension}">}
@@ -25,11 +27,11 @@ module RQRCode
25
27
  self.modules.each_index do |c|
26
28
  tmp = []
27
29
  self.modules.each_index do |r|
28
- y = c*11 + offset
29
- x = r*11 + offset
30
+ y = c*module_size + offset
31
+ x = r*module_size + offset
30
32
 
31
33
  next unless self.is_dark(c, r)
32
- tmp << %{<rect width="11" height="11" x="#{x}" y="#{y}" style="fill:##{color}"/>}
34
+ tmp << %{<rect width="#{module_size}" height="#{module_size}" x="#{x}" y="#{y}" style="fill:##{color}"/>}
33
35
  end
34
36
  result << tmp.join
35
37
  end
@@ -1,3 +1,3 @@
1
1
  module RQRCode
2
- VERSION = "0.5.2"
2
+ VERSION = "0.5.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rqrcode-with-patches
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-05-08 00:00:00.000000000 Z
13
+ date: 2013-05-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: chunky_png