banktools-se 2.6.2 → 2.6.3

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
  SHA1:
3
- metadata.gz: b894da43f509502745e6968c8f9d3480d2d72b59
4
- data.tar.gz: 47544abc5aff3ab18721b38b81747d8981e2da62
3
+ metadata.gz: 6df052c5e1e856bc395b39e9e9355817f5a0bcdb
4
+ data.tar.gz: 82f54243c1e5ed41b80c4689d3c6e0cd7656aa21
5
5
  SHA512:
6
- metadata.gz: 25446e83d4ef271b3a315f42e888913041ec04978cc8167924487e5f621cfe93f9754fbf7a6554eb29aa48c5c12918932b16ecc3728bd1a1608e49d2b967bc70
7
- data.tar.gz: 3a24188bd9119006d3896dd9463148fce4ec43fbf60c4d570396e320dd5fec4944068fa9ca40f0c14d59d53ea662db0250b0282cd46250b08930984ee9205449
6
+ metadata.gz: 4cc99d6b3c4e554c68401414da3e8b679f552603654d42c4667e0a723ce730785f4b0c3ee7a0652e7bc30b610bec98681459df40f4cd5dc0548458cee03ce6dc
7
+ data.tar.gz: 49557f51445e632e2f6ac97717d1a13c98696fcae3a865cf2a62a4918d3733fdbca7948642984b0e7102e1d8717a3f16dd529505ac6bcacefb3dcdf473ebe374
@@ -68,14 +68,15 @@ module BankTools
68
68
  def self.find_all_in_string(string, length_digit: false, pad: "", min_length: 4, max_length: 19)
69
69
  # First, treat the input as one long string of digits.
70
70
  # E.g. "1234 and 5678" becomes "12345678".
71
- digit_string = string.gsub(/\D/, "")
72
- digit_string_length = digit_string.length
73
71
 
74
- candidates = []
72
+ digit_string = string.gsub(/\D/, "")
75
73
 
76
74
  # Then find all substrings ("n-grams") of min_length, and of all other lengths, up to max_length.
77
75
  # So e.g. find all four-digit substrings ("1234", "2345", …), all five-digit substrings and so on.
78
76
 
77
+ digit_string_length = digit_string.length
78
+ candidates = []
79
+
79
80
  0.upto(digit_string.length - min_length) do |start_pos|
80
81
  min_end_pos = start_pos + min_length - 1
81
82
  max_end_pos = [ start_pos + max_length, digit_string_length ].min - 1
@@ -85,6 +86,8 @@ module BankTools
85
86
  end
86
87
  end
87
88
 
89
+ # Get rid of any duplicates.
90
+
88
91
  candidates.uniq!
89
92
 
90
93
  # Finally, limit these substrings to ones that are actually valid OCRs.
@@ -1,5 +1,5 @@
1
1
  module BankTools
2
2
  module SE
3
- VERSION = "2.6.2"
3
+ VERSION = "2.6.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: banktools-se
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.2
4
+ version: 2.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrik Nyh