xirr 1.0.0 → 1.0.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 +4 -4
- data/.github/workflows/ci.yml +11 -0
- data/CHANGE_LOG.md +8 -0
- data/CLAUDE.md +6 -2
- data/Gemfile +6 -0
- data/README.md +2 -1
- data/lib/xirr/config.rb +17 -1
- data/lib/xirr/version.rb +1 -1
- data/lib/xirr.rb +0 -1
- data/test/test_helper.rb +3 -0
- data/xirr.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6d1bfa1f5f5d2e73b6825148f58fa796eafb126a10cf23d3ca3cb2870148929b
|
|
4
|
+
data.tar.gz: fb3209c75bf2e28e76053a7c9b27406523fb38efea638a5090ddaf3309854517
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d924152e766469d3199f0ea9d0bb53d1ebf76198023f77e1528c58d9c6a31e1edbd83285d683946abbe4a752cbd47dc54d471ffe01b1e6801e03813f39c38da6
|
|
7
|
+
data.tar.gz: 33b9837ed6778eb50588a28db97625f56479aa319f7cc1f435b314f1b986d4e7d131a55a1886ddc5a261761c51d5cc6044b9dca3951453c821d01cf529293021
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -7,11 +7,22 @@ on:
|
|
|
7
7
|
|
|
8
8
|
jobs:
|
|
9
9
|
test:
|
|
10
|
+
name: Ruby ${{ matrix.ruby }} / ActiveSupport ${{ matrix.activesupport }}
|
|
10
11
|
runs-on: ubuntu-latest
|
|
11
12
|
strategy:
|
|
12
13
|
fail-fast: false
|
|
13
14
|
matrix:
|
|
14
15
|
ruby: ['3.1', '3.2', '3.3']
|
|
16
|
+
activesupport: ['6.1', '7.2', '8.0', '8.1']
|
|
17
|
+
exclude:
|
|
18
|
+
# ActiveSupport 8 requires Ruby >= 3.2.
|
|
19
|
+
- ruby: '3.1'
|
|
20
|
+
activesupport: '8.0'
|
|
21
|
+
- ruby: '3.1'
|
|
22
|
+
activesupport: '8.1'
|
|
23
|
+
env:
|
|
24
|
+
# Read by the Gemfile to pin activesupport to this line.
|
|
25
|
+
ACTIVESUPPORT: ${{ matrix.activesupport }}
|
|
15
26
|
steps:
|
|
16
27
|
- uses: actions/checkout@v4
|
|
17
28
|
- uses: ruby/setup-ruby@v1
|
data/CHANGE_LOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## Version 1.0.1
|
|
2
|
+
* Support Rails 8.0 and 8.1: allow `activesupport` `< 9` (was `< 8`).
|
|
3
|
+
* `Xirr.config` no longer uses `ActiveSupport::Configurable`, which Rails 8.1
|
|
4
|
+
deprecates (it printed a deprecation warning on load) and Rails 8.2 removes.
|
|
5
|
+
`Xirr.config` is still an `ActiveSupport::OrderedOptions` and
|
|
6
|
+
`Xirr.configure { |c| ... }` works as before.
|
|
7
|
+
* CI now tests every supported ActiveSupport line (6.1, 7.2, 8.0, 8.1).
|
|
8
|
+
|
|
1
9
|
## Version 1.0.0
|
|
2
10
|
* New default solver: a safeguarded Newton (`rtsafe`) that brackets the root and
|
|
3
11
|
falls back to a bisection step per iteration. It converges on flows the old
|
data/CLAUDE.md
CHANGED
|
@@ -10,7 +10,9 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
|
|
10
10
|
- `rake compile` — build the optional native extension into `lib/xirr/` (needs a C compiler).
|
|
11
11
|
- `ruby -Ilib benchmark/solvers.rb` — benchmark the solvers.
|
|
12
12
|
|
|
13
|
-
Requires Ruby `>= 3.1` and `activesupport >= 6.1, <
|
|
13
|
+
Requires Ruby `>= 3.1` and `activesupport >= 6.1, < 9`. To test one
|
|
14
|
+
ActiveSupport line, `ACTIVESUPPORT=8.1 bundle update activesupport` (the Gemfile
|
|
15
|
+
pins it; CI runs a Ruby × ActiveSupport matrix this way). There is no system Ruby on
|
|
14
16
|
the dev box used here; see the project memory for the asdf build recipe and the
|
|
15
17
|
`PATH` / `LD_LIBRARY_PATH` needed to run the suite.
|
|
16
18
|
|
|
@@ -77,6 +79,8 @@ the source of the expected values in `test/`.
|
|
|
77
79
|
|
|
78
80
|
### Configuration
|
|
79
81
|
|
|
80
|
-
`config.rb`
|
|
82
|
+
`config.rb` defines `Xirr.config` (an `ActiveSupport::OrderedOptions`) and
|
|
83
|
+
`Xirr.configure`. It no longer uses `ActiveSupport::Configurable`, which Rails 8.1
|
|
84
|
+
deprecates and 8.2 removes, so don't reintroduce it. Each default is both
|
|
81
85
|
`Xirr.config.<key>` and a frozen constant `Xirr::<KEY>` (the constant keeps the
|
|
82
86
|
original default after reconfiguration). Configure with `Xirr.configure { |c| ... }`.
|
data/Gemfile
CHANGED
|
@@ -2,3 +2,9 @@ source 'https://rubygems.org'
|
|
|
2
2
|
|
|
3
3
|
# Specify your gem's dependencies in xirr.gemspec
|
|
4
4
|
gemspec
|
|
5
|
+
|
|
6
|
+
# Pin one ActiveSupport line to test against it, as CI does:
|
|
7
|
+
# ACTIVESUPPORT=8.1 bundle update activesupport && bundle exec rake
|
|
8
|
+
if (activesupport = ENV['ACTIVESUPPORT'])
|
|
9
|
+
gem 'activesupport', "~> #{activesupport}.0"
|
|
10
|
+
end
|
data/README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# Xirr
|
|
2
2
|
|
|
3
|
+
[](https://badge.fury.io/rb/xirr)
|
|
3
4
|
[](https://github.com/tubedude/xirr/actions/workflows/ci.yml)
|
|
4
5
|
|
|
5
6
|
Calculates the XIRR of a cashflow — the internal rate of return for
|
|
@@ -180,7 +181,7 @@ http://rubydoc.info/github/tubedude/xirr/master/frames
|
|
|
180
181
|
## Supported versions
|
|
181
182
|
|
|
182
183
|
Ruby: >= 3.1
|
|
183
|
-
ActiveSupport: >= 6.1, < 8
|
|
184
|
+
ActiveSupport: >= 6.1, < 9 (Rails 6.1 through 8.1)
|
|
184
185
|
|
|
185
186
|
## Thanks
|
|
186
187
|
|
data/lib/xirr/config.rb
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'active_support/ordered_options'
|
|
4
|
+
|
|
3
5
|
module Xirr
|
|
4
|
-
|
|
6
|
+
# The global settings, read and written as +Xirr.config.<key>+.
|
|
7
|
+
#
|
|
8
|
+
# This used to come from +ActiveSupport::Configurable+, which Rails 8.1
|
|
9
|
+
# deprecates and Rails 8.2 removes. It was only ever a module-level
|
|
10
|
+
# +ActiveSupport::OrderedOptions+, so that is what this returns.
|
|
11
|
+
# @return [ActiveSupport::OrderedOptions]
|
|
12
|
+
def self.config
|
|
13
|
+
@config ||= ActiveSupport::OrderedOptions.new
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Yields {config} for block-style setup:
|
|
17
|
+
# Xirr.configure { |c| c.eps = 1.0e-8 }
|
|
18
|
+
def self.configure
|
|
19
|
+
yield config
|
|
20
|
+
end
|
|
5
21
|
|
|
6
22
|
# Default configuration. Each entry becomes both a config setting
|
|
7
23
|
# (+Xirr.config.eps+) and a frozen constant of the same name upcased
|
data/lib/xirr/version.rb
CHANGED
data/lib/xirr.rb
CHANGED
data/test/test_helper.rb
CHANGED
|
@@ -3,6 +3,9 @@ $LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
|
|
|
3
3
|
require 'minitest/autorun'
|
|
4
4
|
require 'minitest/spec'
|
|
5
5
|
|
|
6
|
+
# ActiveSupport 6.1/7.0 use Logger without requiring it, which concurrent-ruby
|
|
7
|
+
# >= 1.3.5 no longer does for them.
|
|
8
|
+
require 'logger'
|
|
6
9
|
require 'active_support/all'
|
|
7
10
|
|
|
8
11
|
require 'xirr/config.rb'
|
data/xirr.gemspec
CHANGED
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
|
24
24
|
|
|
25
25
|
spec.required_ruby_version = '>=3.1'
|
|
26
26
|
|
|
27
|
-
spec.add_dependency 'activesupport', '>= 6.1', '<
|
|
27
|
+
spec.add_dependency 'activesupport', '>= 6.1', '< 9'
|
|
28
28
|
|
|
29
29
|
spec.add_development_dependency 'minitest', '~> 5.14'
|
|
30
30
|
spec.add_development_dependency 'bundler', '>= 2.2'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: xirr
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- tubedude
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-11-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -19,7 +19,7 @@ dependencies:
|
|
|
19
19
|
version: '6.1'
|
|
20
20
|
- - "<"
|
|
21
21
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: '
|
|
22
|
+
version: '9'
|
|
23
23
|
type: :runtime
|
|
24
24
|
prerelease: false
|
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -29,7 +29,7 @@ dependencies:
|
|
|
29
29
|
version: '6.1'
|
|
30
30
|
- - "<"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '
|
|
32
|
+
version: '9'
|
|
33
33
|
- !ruby/object:Gem::Dependency
|
|
34
34
|
name: minitest
|
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
144
144
|
- !ruby/object:Gem::Version
|
|
145
145
|
version: '0'
|
|
146
146
|
requirements: []
|
|
147
|
-
rubygems_version: 3.5.
|
|
147
|
+
rubygems_version: 3.5.9
|
|
148
148
|
signing_key:
|
|
149
149
|
specification_version: 4
|
|
150
150
|
summary: XIRR and a finance toolkit for Ruby, built on a safeguarded-Newton solver
|