prawn-swiss_qr_bill 0.5.0 → 0.5.1

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: 5871d8607c6b36fc4a2d7d102b1ad2809db65c5b802b0bb578daa52d738ed7e2
4
- data.tar.gz: 437c213e736683b1caee25462817141593d927347da80a1a21a8f4846a24d696
3
+ metadata.gz: c557c856c20a70bceddb8203bca2fe9f178d089d61ec4e4c834faf744d3ac3be
4
+ data.tar.gz: 7e80215d72f150895b7ac341b4ccdc03f85187ef68a22811d2fa9da81f61aa17
5
5
  SHA512:
6
- metadata.gz: b0570742ae29ea8c8b84166bdfd341495b065ac4fa537c197c41a5c04e62c6b9b7907d77e7be9cf51508802f8c9343cbb7795de7c4c9336de8ea78d001b772e0
7
- data.tar.gz: 93990db475afdf4851a98a552ad8be43235e365b0cc79506b613c20f2f1e865b3b8e7b6950d16f45ffa6ddc06e935786210875edac5778c2facd6f627ee0c5d8
6
+ metadata.gz: 9be4ccc1aa68143a96a61cdd3c0650a70ea14003d047ea67cebd62065d60f9d9d1740df1cc79033705d4d9e35d95e63ee80ca69c3d9249636bc87a307eb88d9f
7
+ data.tar.gz: f3f5fe1f9a636bbe5f4091fc943ae38b750c099cf6a4c282a26b47823d7e0a032f652763533b4a7027e2354cf3b5fc97ee33ef18488a06a9e39d10008b12e01c
@@ -53,7 +53,7 @@ module Prawn
53
53
  def valid_check_digits?
54
54
  case @type
55
55
  when 'QRR'
56
- check_digits == modulo10_recursive(number)
56
+ check_digits == Reference.modulo10_recursive(number)
57
57
  when 'SCOR'
58
58
  scor_to_i % 97 == 1
59
59
  end
@@ -75,18 +75,24 @@ module Prawn
75
75
  end
76
76
  end
77
77
 
78
- private
79
-
80
- def standardize(reference)
81
- reference.to_s.strip.gsub(/\s+/, '').upcase
82
- end
83
-
84
- def modulo10_recursive(reference)
78
+ # Generate a check digit with modulo 10 recursive:
79
+ #
80
+ # Can be used as an instance method:
81
+ #
82
+ # Prawn::SwissQRBill::Reference.modulo10_recursive("2202202029999")
83
+ # # will return 1
84
+ def self.modulo10_recursive(reference)
85
85
  numbers = reference.to_s.chars.map(&:to_i)
86
86
  report = numbers.inject(0) { |memo, c| MODULO_TABLE[memo][c] }
87
87
 
88
88
  (10 - report) % 10
89
89
  end
90
+
91
+ private
92
+
93
+ def standardize(reference)
94
+ reference.to_s.strip.gsub(/\s+/, '').upcase
95
+ end
90
96
  end
91
97
  end
92
98
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Prawn
4
4
  module SwissQRBill
5
- VERSION = '0.5.0'
5
+ VERSION = '0.5.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prawn-swiss_qr_bill
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mischa Schindowski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-27 00:00:00.000000000 Z
11
+ date: 2022-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -215,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
215
215
  - !ruby/object:Gem::Version
216
216
  version: '0'
217
217
  requirements: []
218
- rubygems_version: 3.0.3.1
218
+ rubygems_version: 3.2.32
219
219
  signing_key:
220
220
  specification_version: 4
221
221
  summary: Swiss QR-Bill PDFs in Ruby with Prawn