xirr 0.2.4 → 0.2.5

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: 66b347b5dff9686099a5cc4c5edf591f69bfdb80
4
- data.tar.gz: cb80f9aba97b06a467e7155f9d787b8de172745d
3
+ metadata.gz: 893aa205c2c9ff4d6608cb61a9360638bb335974
4
+ data.tar.gz: ea5fc078f408285564152271f95faf34326cf6b8
5
5
  SHA512:
6
- metadata.gz: 098443d1b4836a96cd65544cd932f7dacfecc60632e0dfc5d2db08289948eea691113adaa73a3da21d8508dc3f6272fd62f222e7de4306d66e5c6bb4f2c7cdba
7
- data.tar.gz: f1cd69d853329c9efcab026153906c887ccdf565028300fd52d96a24eb5f10f408801e030cd3cb36fad9531f5763ad5bcf55c5cc3dc0242125b7630227ba4664
6
+ metadata.gz: 3b0d7975ce89e61ad8df222ab66564f3b005f73cd6da3c1c7d0db9a3012376e9af7fe12b882f465558c52716748616bec135b52473e55e7abe3fb67acb1e9b62
7
+ data.tar.gz: a01d888ce35bef52506235ed2b1734d52e46c55615a58a59e260519d5f894f8fe3c55f228654b66efb65e08df11937bf34941dc54fc020a7c571c1ee13e7b182
@@ -1,3 +1,8 @@
1
+ ## Version 0.2.5
2
+
3
+ * Default XIRR does not raise an Exception if cashflow is invalid
4
+
5
+
1
6
  ## Version 0.2.4
2
7
 
3
8
  * Cashflow Invalid Messages are now public.
@@ -16,7 +16,7 @@ module Xirr
16
16
  self.flatten!
17
17
  end
18
18
 
19
- # Check if Cashflow is invalid and raises ArgumentError
19
+ # Check if Cashflow is invalid
20
20
  # @return [Boolean]
21
21
  def invalid?
22
22
  positives.empty? || negatives.empty?
@@ -50,7 +50,7 @@ module Xirr
50
50
  # @param method [Symbol]
51
51
  # @return [Float]
52
52
  # Finds the XIRR according to the method provided. Default to Bisection
53
- def xirr(guess = nil, method = Xirr.config.default_method)
53
+ def xirr_with_exception(guess = nil, method = Xirr.config.default_method)
54
54
  if valid?
55
55
  choose_(method).send :xirr, guess
56
56
  else
@@ -62,11 +62,11 @@ module Xirr
62
62
  # @param guess [Float]
63
63
  # @param method [Symbol]
64
64
  # @return [Float]
65
- def xirr_no_exception(guess = nil, method = Xirr.config.default_method)
65
+ def xirr(guess = nil, method = Xirr.config.default_method)
66
66
  if invalid?
67
67
  BigDecimal.new(0, Xirr::PRECISION)
68
68
  else
69
- xirr(guess, method)
69
+ xirr_with_exception(guess, method)
70
70
  end
71
71
  end
72
72
 
@@ -1,4 +1,4 @@
1
1
  module Xirr
2
2
  # Version of the Gem
3
- VERSION = "0.2.4"
3
+ VERSION = "0.2.5"
4
4
  end
@@ -14,10 +14,14 @@ describe 'Cashflows' do
14
14
  assert_raises(ArgumentError) { @cf.xirr(nil, :no_method) }
15
15
  end
16
16
 
17
- it 'has an Internal Rate of Return on Bisection Method' do
17
+ it 'has an Internal Rate of Return on default Method' do
18
18
  assert_equal '0.225683'.to_f, @cf.xirr
19
19
  end
20
20
 
21
+ it 'has an Internal Rate of Return on default Method' do
22
+ assert_equal '0.225683'.to_f, @cf.xirr(nil, :bisection)
23
+ end
24
+
21
25
  it 'has an Internal Rate of Return on Bisection Method using a Guess' do
22
26
  assert_equal '0.225683'.to_f, @cf.xirr(0.15)
23
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xirr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - tubedude