finrb 0.1.10 → 0.1.11

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
  SHA256:
3
- metadata.gz: 5d1facf891947f1761bb42daf4941bf8557e5fc1fb0388d28265cb7e52bd5876
4
- data.tar.gz: ce0c145c292f33254edafa6ace4aeb257dde55dea04b99c662ad34933d108c4c
3
+ metadata.gz: 70ffddb4fc39b755fea5fc6999eb3b25d9da39f1384f84d21d2a1dd34d2e89b3
4
+ data.tar.gz: a34054fe375454259ccee5f5ac7cf46f12d67705301c0eba88b44c649bbf8046
5
5
  SHA512:
6
- metadata.gz: c589343b7b081456571dbc1644be1c75a301c99232ebe8a87eefcf093357cb116e6de85d2769f40b9e9a4c1edf261a0e96c1b9f6036f267e5c0068cb5e429d99
7
- data.tar.gz: 9267d28b64bdbf8c1e6c4b1faa4a980c7c2449039e89cb2db10e807a234fc5657fac4aaa536a361fa3c8dfe9b3f553eb23e57189c2530937097338fe883a32d5
6
+ metadata.gz: a7695ba1956716fd1e592ccbb01f4b0b45fba4ea7d4b3369d6fc8598070ccf3efeab66207ba1368d881453e21d3cdc6a2f9627bcc410d7345041c042b4cb3b1e
7
+ data.tar.gz: 664c65612915fd5319e844097ad328b95b7605204140f90eb5eb8773123602ff0fee536a87650d20d6fabc8dd57b02f549fabbb8bcc9fc2511d12a3726270da2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # finrb changelog
2
2
 
3
+ ## 0.1.11
4
+
5
+ - fix activesupport configurable deprecation (thanks to @schinery)
6
+ - bump gem versions
7
+
3
8
  ## 0.1.10
4
9
 
5
10
  - bump gem versions
@@ -26,7 +31,7 @@
26
31
 
27
32
  ## 0.1.4
28
33
 
29
- - transactions rails fix
34
+ - transactions rails fix (thanks to @MattHall)
30
35
  - rm ruby 3.0 support
31
36
 
32
37
  ## 0.1.2
@@ -100,12 +100,7 @@ module Finrb
100
100
  def xirr(guess = nil)
101
101
  # Make sure we have a valid sequence of cash flows.
102
102
  positives, negatives = partition { |t| t.amount >= 0 }
103
- if positives.empty? || negatives.empty?
104
- raise(
105
- ArgumentError,
106
- 'Calculation does not converge. Cashflow needs to have a least one positive and one negative value.'
107
- )
108
- end
103
+ raise(ArgumentError, 'Calculation does not converge. Cashflow needs to have a least one positive and one negative value.') if positives.empty? || negatives.empty?
109
104
 
110
105
  func = Function.new(self, :xnpv)
111
106
  rate = [valid(guess)]
data/lib/finrb/config.rb CHANGED
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Finrb
4
- include ActiveSupport::Configurable
4
+ Config = Struct.new(:eps, :guess, :business_days, :periodic_compound)
5
+ private_constant :Config
5
6
 
6
- default_values = { eps: '1.0e-16', guess: 1.0, business_days: false, periodic_compound: false }
7
+ def self.config
8
+ @config ||= Config.new(eps: '1.0e-16', guess: 1.0, business_days: false, periodic_compound: false)
9
+ end
7
10
 
8
- default_values.each do |key, value|
9
- config.__send__(:"#{key.to_sym}=", value)
11
+ def self.configure
12
+ yield(config)
10
13
  end
11
14
  end
data/lib/finrb/rates.rb CHANGED
@@ -8,6 +8,7 @@ module Finrb
8
8
  # @api public
9
9
  class Rate
10
10
  include Comparable
11
+
11
12
  # Accepted rate types
12
13
  TYPES = { apr: 'effective', apy: 'effective', effective: 'effective', nominal: 'nominal' }.freeze
13
14
  public_constant :TYPES
data/lib/finrb/utils.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'active_support'
3
4
  require 'active_support/core_ext/array/wrap'
4
5
  require_relative 'decimal'
5
6
  require 'bigdecimal'
data/lib/finrb.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_support/configurable'
3
+ require 'active_support'
4
4
  require 'finrb/cashflows'
5
5
  require 'finrb/config'
6
6
  require 'finrb/decimal'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: finrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nadir Cohen
@@ -79,6 +79,20 @@ dependencies:
79
79
  - - ">="
80
80
  - !ruby/object:Gem::Version
81
81
  version: '0'
82
+ - !ruby/object:Gem::Dependency
83
+ name: ostruct
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
82
96
  - !ruby/object:Gem::Dependency
83
97
  name: pry
84
98
  requirement: !ruby/object:Gem::Requirement
@@ -249,7 +263,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
249
263
  - !ruby/object:Gem::Version
250
264
  version: '0'
251
265
  requirements: []
252
- rubygems_version: 3.6.9
266
+ rubygems_version: 4.0.8
253
267
  specification_version: 4
254
268
  summary: Ruby gem for financial calculations/modeling
255
269
  test_files: []