qrcode 0.1.1 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 252ff500900481a78fcb576f219a32ea37d3eaffb5640319191bf93bdbd686e8
4
- data.tar.gz: 4dd3c5e2663b6713c0a93cab9f221cb1ae79ed11d34b4388510725fb4651744e
3
+ metadata.gz: ccad4946a6158f733c2974ec052caa690c55036270b2b2fdad7e8ed07cc91108
4
+ data.tar.gz: cb827b3cb1120d25a7f9f4ee537a3e96aff506807b62eb56b72c7b66a19954c0
5
5
  SHA512:
6
- metadata.gz: 2e03c920a3cc6e44a8bff89f60a451bb51cd2c435a0b7bba6abd00bcac0ad7318090ebec52d74dd4972d45a57750b495d2ef633039b2e2b66985d4ec626db02b
7
- data.tar.gz: c20386221cbe303162f38de3e1169aa59faf488bf5a900ae9c440c0cb24515c3a9c929786b917ddcf3595d7e56e37ad8a464900043d07c88aa3af8f50eb152e7
6
+ metadata.gz: 6c76e3d705e4a5b5a88d3fde8a2118317c1490495eda5891ddb8c6f90f6f86b87c857b7fed244490b165aff7bf03b98fca048d5f872e0715e92de43b3da893ba
7
+ data.tar.gz: bbfcb3883238642e8d9ad5d3f2541e07e99b5b1e14dcfde8cbe3d6855379e9c560afa418337b71ea8b24acc2b7064015fda01dd0bf92e812b462e3d122415c78
checksums.yaml.gz.sig CHANGED
Binary file
@@ -17,6 +17,11 @@ module QRCode
17
17
  @light_color = light_color
18
18
  end
19
19
 
20
+ # @returns [Boolean] true if background should be transparent
21
+ def transparent?
22
+ @light_color.nil? || @light_color == "transparent"
23
+ end
24
+
20
25
  def render
21
26
  total_size = (qrcode.size + (border * 2)) * cell_size
22
27
 
@@ -24,8 +29,10 @@ module QRCode
24
29
  svg << %[<?xml version="1.0" encoding="UTF-8"?>]
25
30
  svg << %[<svg xmlns="http://www.w3.org/2000/svg" width="#{total_size}" height="#{total_size}" viewBox="0 0 #{total_size} #{total_size}">]
26
31
 
27
- # Background rectangle
28
- svg << %[ <rect x="0" y="0" width="#{total_size}" height="#{total_size}" fill="#{light_color}"/>]
32
+ # Background rectangle (only if not transparent)
33
+ unless transparent?
34
+ svg << %[ <rect x="0" y="0" width="#{total_size}" height="#{total_size}" fill="#{light_color}"/>]
35
+ end
29
36
 
30
37
  # Generate dark modules as rectangles
31
38
  qrcode.size.times do |row|
@@ -10,5 +10,5 @@
10
10
  # Copyright, 2025, by Samuel Williams.
11
11
 
12
12
  module QRCode
13
- VERSION = "0.1.1"
13
+ VERSION = "0.2.0"
14
14
  end
data/readme.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  A pure Ruby library for generating QR codes with multiple output formats. Generate QR codes as text art for terminal display or as scalable SVG graphics for web and print applications.
4
4
 
5
+ ![QR Code Example](output.svg)
6
+
5
7
  This is a fork of [`rqrcode_core`](https://github.com/whomwah/rqrcode_core), which was originally adapted in 2008 from a Javascript library by [Kazuhiko Arase](https://github.com/kazuhikoarase/qrcode-generator).
6
8
 
7
9
  [![Development Status](https://github.com/socketry/qrcode/workflows/Test/badge.svg)](https://github.com/socketry/qrcode/actions?workflow=Test)
@@ -26,16 +28,23 @@ Please see the [project documentation](https://socketry.github.io/qrcode/) for m
26
28
 
27
29
  Please see the [project releases](https://socketry.github.io/qrcode/releases/index) for all releases.
28
30
 
31
+ ### v0.2.0
32
+
33
+ - Added transparent SVG background support using `light_color: nil` or `light_color: "transparent"`.
34
+
29
35
  ### v0.1.0
30
36
 
31
37
  - **Breaking**: Complete refactor of encoder architecture with cleaner segment-based design.
32
38
  - **Breaking**: Renamed `RSBlock` to `ErrorCorrectionBlock` with cleaner method names (`for`, `table_entry_for`).
33
39
  - **Breaking**: Simplified `Code` constructor to take segments array, added `Code.build()` factory method.
34
40
  - **Breaking**: Removed redundant `Multi` class - multi-segment support now built into `Code` directly.
41
+ - **Breaking**: Renamed ASCII output to Text output (`QRCode.text()` instead of `QRCode.ascii()`).
42
+ - **Breaking**: Renamed `ERROR_CORRECT_LEVEL` to `ERROR_CORRECTION_LEVEL` for better grammar.
35
43
  - Added self-contained segment classes: `Segment`, `NumericSegment`, `AlphanumericSegment`.
36
44
  - Added comprehensive test coverage for output functionality (Text and SVG).
37
45
  - Added `size` alias for `module_count` for cleaner API.
38
46
  - Added proper documentation explaining error correction level encoding from ISO/IEC 18004.
47
+ - Added getting started guide with comprehensive usage examples.
39
48
  - Improved code organization with `QRCode::Encoder` namespace for all encoding classes.
40
49
  - Removed QR prefix from encoder file and class names for cleaner codebase.
41
50
 
data/releases.md CHANGED
@@ -1,14 +1,21 @@
1
1
  # Releases
2
2
 
3
+ ## v0.2.0
4
+
5
+ - Added transparent SVG background support using `light_color: nil` or `light_color: "transparent"`.
6
+
3
7
  ## v0.1.0
4
8
 
5
9
  - **Breaking**: Complete refactor of encoder architecture with cleaner segment-based design.
6
10
  - **Breaking**: Renamed `RSBlock` to `ErrorCorrectionBlock` with cleaner method names (`for`, `table_entry_for`).
7
11
  - **Breaking**: Simplified `Code` constructor to take segments array, added `Code.build()` factory method.
8
12
  - **Breaking**: Removed redundant `Multi` class - multi-segment support now built into `Code` directly.
13
+ - **Breaking**: Renamed ASCII output to Text output (`QRCode.text()` instead of `QRCode.ascii()`).
14
+ - **Breaking**: Renamed `ERROR_CORRECT_LEVEL` to `ERROR_CORRECTION_LEVEL` for better grammar.
9
15
  - Added self-contained segment classes: `Segment`, `NumericSegment`, `AlphanumericSegment`.
10
16
  - Added comprehensive test coverage for output functionality (Text and SVG).
11
17
  - Added `size` alias for `module_count` for cleaner API.
12
18
  - Added proper documentation explaining error correction level encoding from ISO/IEC 18004.
19
+ - Added getting started guide with comprehensive usage examples.
13
20
  - Improved code organization with `QRCode::Encoder` namespace for all encoding classes.
14
21
  - Removed QR prefix from encoder file and class names for cleaner codebase.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qrcode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Duncan Robertson
metadata.gz.sig CHANGED
Binary file