crabfarm 0.1.1 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 698aaecadeceabde24ba0f6adecc122982830391
4
- data.tar.gz: a55da401f0d8daa13b78f4e10f23e02f7cdf4d24
3
+ metadata.gz: 49343d990ddd94c9640f37040a6fe5fc9a97ab49
4
+ data.tar.gz: f75e89f9dd4b5154f01df31837b98981fed38a3c
5
5
  SHA512:
6
- metadata.gz: fbda6ec7bd9917498511b82f0cde2cf715a8743735450a38f17874c9105b8b4cfebcfa169983bec118be6de87629eb4cf9934f7fb9e7a281ddcb9fe7001eb368
7
- data.tar.gz: c68eb0cc4c8a6b28157e34f25fb2ad68b4b191f272d2a91c04bd3beb6eda37c896943e0829623947e132844eeb90f588adb7420982dfe2532d405d0a9010396d
6
+ metadata.gz: f841a5d9a50476e38b7a1252b3de75fc132ffcbc4ecb7bd25f49cbfad976eab75f825f47c5ca1afa9c41c53f4713baeb2da8578ed233b2be40897b25f859348f
7
+ data.tar.gz: c183db189f4968561409c0eea25a54a7ad4fb015b7d8cd3abcceefe3edc7790392626b5944b4bfa5d32b06bf074f357b00867762fb8ee3e1a97889cb0618e778
@@ -85,8 +85,7 @@ module Crabfarm
85
85
  def extract_number_from_string _value, _options
86
86
  decimal_mark = _options.fetch(:decimal_mark, '.') # TODO: make default decimal mark configurable
87
87
  thousand_mark = _options.fetch(:thousand_mark, infer_thousand_separator(decimal_mark))
88
- num_rgx = /(?:\.\d+|\d{1,3}(?:\,\d{3})+(?:\.\d+)?|\d+(?:\.\d+)?)/
89
- num_rgx = Regexp.new "(?:\\#{decimal_mark}\\d+|\\d{1,3}(?:\\#{thousand_mark}\\d{3})+(?:\\#{decimal_mark}\\d+)?|\\d+(?:\\#{decimal_mark}\\d+)?)"
88
+ num_rgx = Regexp.new "-?(?:\\#{decimal_mark}\\d+|\\d{1,3}(?:\\#{thousand_mark}\\d{3})+(?:\\#{decimal_mark}\\d+)?|\\d+(?:\\#{decimal_mark}\\d+)?)"
90
89
  matches = _value.scan num_rgx
91
90
  fail_with "'#{_value}' has an ambiguous numeric format" if matches.count > 1
92
91
  fail_with "'#{_value}' does not contain any number" if matches.count < 1
@@ -1,3 +1,3 @@
1
1
  module Crabfarm
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crabfarm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ignacio Baixas