gobl 0.3.0 → 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: a390a31d1775261bd8d96d822e8ed3930d72182b415fbaab018f9770f5b4dd58
4
- data.tar.gz: dd5941c6852c584338073791df5795c3850df86767a0d5389c308101592a8bf6
3
+ metadata.gz: 5d76cccae7dcefa86ad6553de26fdccdcf1070c86b94397b2afd6fce95973c5d
4
+ data.tar.gz: b08932429a3dceda76e61fad765e221126542b105b5141cfcac2bbab7df9d9fa
5
5
  SHA512:
6
- metadata.gz: 566063350518154791aed662b0282764e774111e6b9b2c38602a0ada0c85171d22a2e9d98a7d35248991e085fe878c03e510032143dcc3f515ad33244500aab1
7
- data.tar.gz: 2d70dd28fe21aad06e20e84345deeee4267cbbb6e94944ea844b2ab1259e9a2e015a97e83b5ea091c9d3e7350d028216b38b54c3ea6a586274d3ffa2fa90b4e3
6
+ metadata.gz: 343e9b78a8c5d9e41614345310358b12b64360a2d6da81b52d5e0e03a4f819f045c0caa79772a02a285f6a62f991ff5804298eeaf6e0fe559a56d25c40a2cf01
7
+ data.tar.gz: d623de76e1c087bc6e391c43e5501ac74a593dadd0e3548ad1649b4955130589164538da7d3454d875f9a19bbc029e73e63cc47c7b5304eb51e0e9d254e8f091
@@ -50,10 +50,9 @@ module GOBL
50
50
  raise 'exponent too high' if exp > 100
51
51
 
52
52
  p = 10**exp
53
- v1 = value / p
54
- v2 = value - (v1 * p)
55
- v2 = -v2 if v2.negative?
56
- 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)
57
56
  end
58
57
 
59
58
  # Rescales each {Amount} in the pair ensuring both have the same exponent
@@ -208,7 +207,7 @@ module GOBL
208
207
  v2 = x[1].to_i
209
208
  e = x[1].length
210
209
  v *= 10**e
211
- v += v2
210
+ v += x[0].match?(/^-/) ? -v2 : v2
212
211
  end
213
212
 
214
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.0'
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.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Lilue
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-10-25 00:00:00.000000000 Z
13
+ date: 2022-11-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -194,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
194
  - !ruby/object:Gem::Version
195
195
  version: 3.1.4
196
196
  requirements: []
197
- rubygems_version: 3.1.4
197
+ rubygems_version: 3.3.7
198
198
  signing_key:
199
199
  specification_version: 4
200
200
  summary: Minimalist ruby version of the GOBL library