gnucash 1.3.0 → 1.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: 3b8e70e39febe1d2afe7ff866b5715f2e18620b1
4
- data.tar.gz: 7bfd0b8791a02046d5cd61ccb37023ed1d2b613d
3
+ metadata.gz: 900fd81bad3ba0b11854c9337bc222b535804b02
4
+ data.tar.gz: 5549a7746596aae5be8f4081a1b6ba322b2f98b0
5
5
  SHA512:
6
- metadata.gz: e77495aabd9da8f62edc77c990ec4f547771fe80a9c31cc0ce5736b2e1923d12d1f13d7800bf6dafc2ba1784764aa150f5a326b75af110061ad581f376966d23
7
- data.tar.gz: ebbbd48420074fe267d137897ecffbe7dd38c717b1b56763e29e677379b65922b890b2879014e7045a8b7ff63d341fb4a8a4f83f4a12435cb45f84bc2064202c
6
+ metadata.gz: e5bb85d5c99510c17af02d0b649f637a4c939eb90e2392bddeadc22926699c96a28d11fb7cba43a7114d29e4d38fb413bbfb082611ca2c70f6f9e6fb13f9bd4b
7
+ data.tar.gz: f0f3934018eb94ae3a989abdbb95c94aaeb3dd8f0a399e3fa85e8f26937184577d55f775b8a38a51334f845942f62ca32225041cbc651139e3db70d252c1b139
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gnucash (1.3.0)
4
+ gnucash (1.3.1)
5
5
  nokogiri
6
6
 
7
7
  GEM
@@ -50,7 +50,7 @@ module Gnucash
50
50
  lcm_div = @div.lcm(other.div)
51
51
  Value.new((@val * (lcm_div / @div)) + (other.val * (lcm_div / other.div)), lcm_div)
52
52
  elsif other.is_a?(Numeric)
53
- (to_f + other).round(2)
53
+ to_f + other
54
54
  else
55
55
  raise "Unexpected argument"
56
56
  end
@@ -66,7 +66,7 @@ module Gnucash
66
66
  lcm_div = @div.lcm(other.div)
67
67
  Value.new((@val * (lcm_div / @div)) - (other.val * (lcm_div / other.div)), lcm_div)
68
68
  elsif other.is_a?(Numeric)
69
- (to_f - other).round(2)
69
+ to_f - other
70
70
  else
71
71
  raise "Unexpected argument"
72
72
  end
@@ -89,7 +89,7 @@ module Gnucash
89
89
  other = other.to_f
90
90
  end
91
91
  if other.is_a?(Numeric)
92
- (to_f * other).round(2)
92
+ to_f * other
93
93
  else
94
94
  raise "Unexpected argument (#{other.inspect})"
95
95
  end
@@ -105,7 +105,7 @@ module Gnucash
105
105
  other = other.to_f
106
106
  end
107
107
  if other.is_a?(Numeric)
108
- (to_f / other).round(2)
108
+ to_f / other
109
109
  else
110
110
  raise "Unexpected argument (#{other.inspect})"
111
111
  end
@@ -1,4 +1,4 @@
1
1
  module Gnucash
2
2
  # gem version
3
- VERSION = "1.3.0"
3
+ VERSION = "1.3.1"
4
4
  end
@@ -34,7 +34,7 @@ module Gnucash
34
34
  a = Value.new("1234/100")
35
35
  b = 15
36
36
  c = a + b
37
- expect(c).to eq 27.34
37
+ expect(c.round(2)).to eq 27.34
38
38
  end
39
39
 
40
40
  it "allows subtracting two value objects" do
@@ -48,7 +48,7 @@ module Gnucash
48
48
  a = Value.new("890/100")
49
49
  b = 7.8
50
50
  c = a - b
51
- expect(c).to eq 1.1
51
+ expect(c.round(2)).to eq 1.1
52
52
  end
53
53
 
54
54
  it "allows negating a Value object" do
@@ -61,14 +61,28 @@ module Gnucash
61
61
  a = Value.new("100/100")
62
62
  b = 12
63
63
  c = a * b
64
- expect(c).to eq 12.00
64
+ expect(c.round(2)).to eq 12.00
65
+ end
66
+
67
+ it "allows multiplying a Value by a Value" do
68
+ a = Value.new("100/100")
69
+ b = Value.new(1200)
70
+ c = a * b
71
+ expect(c.round(2)).to eq 12.00
65
72
  end
66
73
 
67
74
  it "allows dividing a Value by a Numeric" do
68
75
  a = Value.new("150000/100")
69
76
  b = 150
70
77
  c = a / b
71
- expect(c).to eq 10.0
78
+ expect(c.round(2)).to eq 10.0
79
+ end
80
+
81
+ it "allows dividing a Value by a Value" do
82
+ a = Value.new("150000/100")
83
+ b = Value.new(15000)
84
+ c = a / b
85
+ expect(c.round(2)).to eq 10.0
72
86
  end
73
87
 
74
88
  it "formats the number with two decimal places" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gnucash
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Holtrop