iron_bank 3.3.0 → 3.3.1

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: d983ad6ae1f11b84ea83cfa0bcc28593d4dfd7b8
4
- data.tar.gz: 3b1d94f5dbc8b95ba878905cd93d5c13d5988bf7
3
+ metadata.gz: 769ee53d87a8d960c4005de74c22e071fb7f63bb
4
+ data.tar.gz: 5bde4998fd298a7e85803715fa449c5b15dd15e8
5
5
  SHA512:
6
- metadata.gz: ef0840337aa6a1430ab81f9ab85f287dc034091b09bfb192ae2320b30dcbaeb6cca9dc06b125051ae348a2fa2ef0e033bd0540f2dceddbe1d9a7fc1253ae47d8
7
- data.tar.gz: 2b68c9588d78bde9c27f6d0a81948539acdf27607329f7670c47677ea46deb1c96bc92e55139a0d2dc2593560c97f426d532e2ac0c637ea60a52b47cc7ef41c8
6
+ metadata.gz: f498334b14d2d8d948df9e4cbb08bf03a7016002bc6c6d58ff6243d9b98ecb76f334078656d2cadade246f5c0a446c23b26f017612d2853a89146335f710a4c1
7
+ data.tar.gz: b2ce083a851bff6d799f8c269a60a3e338d898578f1a89d18b91090ca1c66f4c8e32bba8e13dbad073eda395f340aaad51f6e9e0723959724b5d292e1e8afd8c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- iron_bank (3.3.0)
4
+ iron_bank (3.3.1)
5
5
  faraday (~> 0)
6
6
  faraday_middleware (~> 0)
7
7
  nokogiri (~> 1)
data/lib/iron_bank/csv.rb CHANGED
@@ -4,26 +4,25 @@ module IronBank
4
4
  # A custom CSV converter
5
5
  #
6
6
  class CSV < ::CSV
7
- CSV::Converters[:decimal_integer] = lambda { |field|
8
- begin
9
- encoding = field.encode(CSV::ConverterEncoding)
7
+ DECIMAL_INTEGER_REGEX = /^[+-]?\d+$/.freeze
8
+ DECIMAL_FLOAT_REGEX = /^[+-]?(?:\d*\.|\.\d*)\d*$/.freeze
10
9
 
11
- # Match: [1, 10, 100], No match: [0.1, .1, 1., 0b10]
12
- /^[+-]?\d+$/.match?(encoding) ? encoding.to_i : field
13
- rescue # encoding or integer conversion
14
- field
15
- end
16
- }
10
+ CSV::Converters[:decimal_integer] = lambda do |field|
11
+ return field unless field
17
12
 
18
- CSV::Converters[:decimal_float] = lambda { |field|
19
- begin
20
- encoding = field.encode(CSV::ConverterEncoding)
13
+ encoding = field.encode(CSV::ConverterEncoding)
21
14
 
22
- # Match: [1.0, 1., 0.1, .1], No match: [1, 0b10]
23
- /^[+-]?(?:\d*\.|\.\d*)\d*$/.match?(encoding) ? encoding.to_f : field
24
- rescue # encoding or float conversion
25
- field
26
- end
27
- }
15
+ # Match: [1, 10, 100], No match: [0.1, .1, 1., 0b10]
16
+ DECIMAL_INTEGER_REGEX.match?(encoding) ? encoding.to_i : field
17
+ end
18
+
19
+ CSV::Converters[:decimal_float] = lambda do |field|
20
+ return field unless field
21
+
22
+ encoding = field.encode(CSV::ConverterEncoding)
23
+
24
+ # Match: [1.0, 1., 0.1, .1], No match: [1, 0b10]
25
+ DECIMAL_FLOAT_REGEX.match?(encoding) ? encoding.to_f : field
26
+ end
28
27
  end
29
28
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IronBank
4
- VERSION = "3.3.0"
4
+ VERSION = "3.3.1"
5
5
  API_VERSION = "v1"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iron_bank
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mickael Pham
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2019-05-20 00:00:00.000000000 Z
14
+ date: 2019-06-07 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bump