gobl 0.3.1 → 0.3.2

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: 8dccbd5dc331a3ff9ed4331c5ee3a8a0bf01fc09b06c72f435d581a4829cab1b
4
- data.tar.gz: 18cb30024e7658008b6d3a093aeb8ae04016f362354eccb52aee8624eb483826
3
+ metadata.gz: 5d76cccae7dcefa86ad6553de26fdccdcf1070c86b94397b2afd6fce95973c5d
4
+ data.tar.gz: b08932429a3dceda76e61fad765e221126542b105b5141cfcac2bbab7df9d9fa
5
5
  SHA512:
6
- metadata.gz: 5f1e241dd4fef640d5846c895956eb3a3deedd81ab7ce0a61e350e37c29ad090d00cd649a1558f8efd3c36e5c2271a80c4ff9d4c8f5144263683b452a19e71e7
7
- data.tar.gz: 3956067376f62b294ef112dc72ec73352be4d2bf43c8c10bdf4bd713125efe5a8c6b85ef78806ae140c9b09cbcfa52101cb4beb741697ac4ffd6eb1a90249836
6
+ metadata.gz: 343e9b78a8c5d9e41614345310358b12b64360a2d6da81b52d5e0e03a4f819f045c0caa79772a02a285f6a62f991ff5804298eeaf6e0fe559a56d25c40a2cf01
7
+ data.tar.gz: d623de76e1c087bc6e391c43e5501ac74a593dadd0e3548ad1649b4955130589164538da7d3454d875f9a19bbc029e73e63cc47c7b5304eb51e0e9d254e8f091
@@ -50,11 +50,9 @@ module GOBL
50
50
  raise 'exponent too high' if exp > 100
51
51
 
52
52
  p = 10**exp
53
- v1 = value.abs / p
54
- v1 = -v1 if value.negative?
55
- v2 = value - (v1 * p)
56
- v2 = -v2 if v2.negative?
57
- format('%d.%0*d', v1, exp, v2)
53
+ v1, v2 = value.abs.divmod(p)
54
+ sign = value.negative? ? '-' : ''
55
+ format('%s%d.%0*d', sign, v1, exp, v2)
58
56
  end
59
57
 
60
58
  # Rescales each {Amount} in the pair ensuring both have the same exponent
@@ -209,7 +207,7 @@ module GOBL
209
207
  v2 = x[1].to_i
210
208
  e = x[1].length
211
209
  v *= 10**e
212
- v += v.positive? ? v2 : -v2
210
+ v += x[0].match?(/^-/) ? -v2 : v2
213
211
  end
214
212
 
215
213
  @value = v
data/lib/gobl/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GOBL
4
- VERSION = '0.3.1'
4
+ VERSION = '0.3.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gobl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Lilue