exonio 0.5.4 → 0.7.0

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: 2177008fa8ad1fce23bd78efe356f146ab94350acb804eacc6fbdf7cf0b73756
4
- data.tar.gz: a8a144747cec2755ae8c6739b91b8a4cc8eee4630ac6c950147c2eca260d5711
3
+ metadata.gz: d9378589552d7f80a4b46042b0a0a55dc84e79d65484f53381a8d534b20186dc
4
+ data.tar.gz: 91ca4fd17ff38669d5c8284f377fabae0d689ce24e489fa391032815d926c33f
5
5
  SHA512:
6
- metadata.gz: 74c8699b45184bcee100bda0aacf58f526461a02f4904e728ab9d1c2f4c3822a30fd19ea5fdff3de8c7f325eded5428e0946e2f243d15515c008181958404052
7
- data.tar.gz: 170be11052472cdc4ed37f11bd6821a5f3273b44fd3e8374a52502918bb6d84a67f2c6e4483d35626533851852abee7e2426d04dfc1d89dbd00331d4a16c9131
6
+ metadata.gz: 3b89195bd85a1fb68a01db4cfbedb845e1b15a3dcdcdf8099fd8bd74f5d782f7e2ebaf538221d467c87b193f2389f1225a41e1b2dfb60e23ffd8d0d428875cb6
7
+ data.tar.gz: 295d2b187c08d1a65a6533293756f73635ed6457ba57895f220b6b845cd38601d812dde4fdc056bc6330e295d0eecdf816a8ddf0f6959dcbbe2dbbf0fb5a8cc8
@@ -0,0 +1,18 @@
1
+ version: 2
2
+
3
+ updates:
4
+ - open-pull-requests-limit: 10
5
+ package-ecosystem: "bundler"
6
+ directory: "/"
7
+ schedule:
8
+ interval: "monthly"
9
+ reviewers:
10
+ - "noverde/developers"
11
+
12
+ - open-pull-requests-limit: 10
13
+ package-ecosystem: "github-actions"
14
+ directory: "/"
15
+ schedule:
16
+ interval: "monthly"
17
+ reviewers:
18
+ - "noverde/developers"
@@ -0,0 +1,26 @@
1
+ name: RubyGem
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - v*
7
+
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - uses: actions/checkout@v3
14
+
15
+ - name: Set up Ruby
16
+ uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: "3.1"
19
+
20
+ - name: Install dependencies
21
+ run: bundle install
22
+
23
+ - name: Publish to RubyGems
24
+ uses: noverde/github-actions/push-rubygems@main
25
+ with:
26
+ rubygems_api_key: ${{ secrets.RUBYGEMS_TOKEN }}
@@ -0,0 +1,32 @@
1
+ name: Tests
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ test:
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ os: [ubuntu-latest, macos-latest]
14
+ ruby: ["2.3.1", "2.7", "3.0", "3.1", "3.2"]
15
+
16
+ runs-on: ${{ matrix.os }}
17
+
18
+ steps:
19
+ - uses: actions/checkout@v3
20
+ - name: Remove Gemfile.lock
21
+ run: rm Gemfile.lock
22
+ - name: Set up Ruby
23
+ uses: ruby/setup-ruby@v1
24
+ with:
25
+ ruby-version: ${{ matrix.ruby }}
26
+ bundler-cache: true
27
+
28
+ - name: Install dependencies
29
+ run: bundle install
30
+
31
+ - name: Run tests
32
+ run: bundle exec rake spec
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  *.gem
2
2
  *.rbc
3
+ bin/
3
4
  /.config
4
5
  /coverage/
5
6
  /InstalledFiles
@@ -29,8 +30,8 @@ build/
29
30
  # for a library or gem, you might want to ignore these files since the code is
30
31
  # intended to run in multiple environments; otherwise, check them in:
31
32
  # Gemfile.lock
32
- # .ruby-version
33
33
  # .ruby-gemset
34
+ .ruby-version
34
35
 
35
36
  # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
36
37
  .rvmrc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.7.0
4
+
5
+ * Implements `nominal` method (#35)
6
+ * Update dependencies (#32)
7
+
8
+ ## 0.6.1
9
+
10
+ * Update dependencies (#25)
11
+
12
+ ## 0.6.0
13
+
14
+ * Implements `effect` method (#21)
15
+
3
16
  ## 0.5.4
4
17
 
5
18
  * Fix zero interest rate (#18)
data/Gemfile.lock CHANGED
@@ -1,41 +1,40 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- exonio (0.5.4)
4
+ exonio (0.7.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
9
  byebug (8.2.5)
10
- coderay (1.1.2)
11
- diff-lcs (1.3)
10
+ coderay (1.1.3)
11
+ diff-lcs (1.5.0)
12
12
  method_source (1.0.0)
13
- pry (0.13.1)
13
+ pry (0.14.1)
14
14
  coderay (~> 1.1)
15
15
  method_source (~> 1.0)
16
16
  pry-byebug (3.3.0)
17
17
  byebug (~> 8.0)
18
18
  pry (~> 0.10)
19
- rake (13.0.1)
20
- rspec (3.9.0)
21
- rspec-core (~> 3.9.0)
22
- rspec-expectations (~> 3.9.0)
23
- rspec-mocks (~> 3.9.0)
24
- rspec-core (3.9.2)
25
- rspec-support (~> 3.9.3)
26
- rspec-expectations (3.9.2)
19
+ rake (13.0.6)
20
+ rspec (3.12.0)
21
+ rspec-core (~> 3.12.0)
22
+ rspec-expectations (~> 3.12.0)
23
+ rspec-mocks (~> 3.12.0)
24
+ rspec-core (3.12.0)
25
+ rspec-support (~> 3.12.0)
26
+ rspec-expectations (3.12.0)
27
27
  diff-lcs (>= 1.2.0, < 2.0)
28
- rspec-support (~> 3.9.0)
29
- rspec-mocks (3.9.1)
28
+ rspec-support (~> 3.12.0)
29
+ rspec-mocks (3.12.0)
30
30
  diff-lcs (>= 1.2.0, < 2.0)
31
- rspec-support (~> 3.9.0)
32
- rspec-support (3.9.3)
31
+ rspec-support (~> 3.12.0)
32
+ rspec-support (3.12.0)
33
33
 
34
34
  PLATFORMS
35
35
  ruby
36
36
 
37
37
  DEPENDENCIES
38
- bundler (~> 1.11)
39
38
  exonio!
40
39
  pry-byebug (~> 3.3.0)
41
40
  rake (~> 13.0)
data/README.md CHANGED
@@ -4,7 +4,7 @@ This gem brings some useful Excel formulas to Ruby. For now, it just has
4
4
  financial formulas, but could have more (like statistical formulas) in the future.
5
5
 
6
6
  [![Gem Version](https://badge.fury.io/rb/exonio.svg)](https://badge.fury.io/rb/exonio)
7
- [![Build Status](https://travis-ci.org/Noverde/exonio.svg?branch=master)](https://travis-ci.org/Noverde/exonio)
7
+ [![Tests](https://github.com/noverde/exonio/actions/workflows/tests.yml/badge.svg)](https://github.com/noverde/exonio/actions)
8
8
 
9
9
  ## Installation
10
10
 
@@ -32,6 +32,25 @@ To use Exonio you just have to call the method you like to use. Example:
32
32
 
33
33
  ## Available Formulas
34
34
 
35
+ ### EFFECT
36
+
37
+ The Excel EFFECT function returns the effective annual interest rate, given a nominal interest rate and the number of compounding periods per year.
38
+ Effective annual interest rate is the interest rate actually earned due to compounding.
39
+ More about this function [EFFECT](https://exceljet.net/excel-functions/excel-effect-function)
40
+
41
+ ```ruby
42
+ Exonio.effect(0.05, 10 * 12) # ==> 0.05126014873337037
43
+ ```
44
+
45
+ ### NOMINAL
46
+
47
+ The Excel NOMINAL function returns the nominal interest rate when given an effective annual interest rate and the number of compounding periods per year. The effective rate is the actual rate due to compounding. The nominal rate is typically the stated rate.
48
+ More about this function [NOMINAL](https://exceljet.net/functions/nominal-function)
49
+
50
+ ```ruby
51
+ Exonio.nominal(0.05, 12 / 6) # ==> 0.04939015319191986
52
+ ```
53
+
35
54
  ### FV
36
55
 
37
56
  What is the future value after 10 years of saving $100 now, with
data/exonio.gemspec CHANGED
@@ -18,7 +18,6 @@ Gem::Specification.new do |spec|
18
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.11"
22
21
  spec.add_development_dependency "rake", "~> 13.0"
23
22
  spec.add_development_dependency "rspec", "~> 3.0"
24
23
  spec.add_development_dependency "pry-byebug", "~> 3.3.0"
@@ -1,5 +1,38 @@
1
1
  module Exonio
2
2
  module Financial
3
+ # Calculates the effective annual interest rate, given a nominal interest rate and the number of
4
+ # compounding periods. Nominal interest rate is the stated rate on the financial product.
5
+ # Effective annual interest rate is the interest rate actually earned due to compounding.
6
+ # constant-amount periodic payments and a constant interest rate.
7
+ #
8
+ # @param rate [Float] The nominal interest rate as decimal (not per cent) per period
9
+ # @param nper [Integer] The number of compounding periods
10
+ #
11
+ # @return [Float]
12
+ #
13
+ # @example
14
+ # Exonio.effect(0.05, 12 * 10) # ==> 0.05126014873337037
15
+ #
16
+ def effect(rate, nper)
17
+ (1 + rate / nper) ** nper - 1
18
+ end
19
+
20
+ # Calculates the nominal interest rate when given an effective annual interest rate and the number of compounding periods per year.
21
+ # The effective rate is the actual rate due to compounding. The nominal rate is typically the stated rate.
22
+ #
23
+ # @param rate [Float] The effective annual interest rate as decimal (not per cent).
24
+ # @param npery [Integer] Number of compounding periods per year.
25
+ #
26
+ # @return [Float]
27
+ #
28
+ # @example
29
+ # Exonio.nominal(0.05, 12 / 2) # ==> 0.04939015319191986
30
+ #
31
+ def nominal(rate, npery)
32
+ npery * ((1 + rate)**(1.0/npery) - 1)
33
+ end
34
+
35
+
3
36
  # Calculates the future value of an annuity investment based on
4
37
  # constant-amount periodic payments and a constant interest rate.
5
38
  #
@@ -1,3 +1,3 @@
1
1
  module Exonio
2
- VERSION = "0.5.4"
2
+ VERSION = "0.7.0"
3
3
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exonio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafael Izidoro
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-29 00:00:00.000000000 Z
11
+ date: 2023-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.11'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.11'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rake
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -74,17 +60,17 @@ executables: []
74
60
  extensions: []
75
61
  extra_rdoc_files: []
76
62
  files:
63
+ - ".github/dependabot.yml"
64
+ - ".github/workflows/gem-push.yml"
65
+ - ".github/workflows/tests.yml"
77
66
  - ".gitignore"
78
67
  - ".rspec"
79
- - ".travis.yml"
80
68
  - CHANGELOG.md
81
69
  - Gemfile
82
70
  - Gemfile.lock
83
71
  - LICENSE.md
84
72
  - README.md
85
73
  - Rakefile
86
- - bin/console
87
- - bin/setup
88
74
  - exonio.gemspec
89
75
  - lib/exonio.rb
90
76
  - lib/exonio/financial.rb
@@ -109,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
95
  - !ruby/object:Gem::Version
110
96
  version: '0'
111
97
  requirements: []
112
- rubygems_version: 3.0.3
98
+ rubygems_version: 3.3.26
113
99
  signing_key:
114
100
  specification_version: 4
115
101
  summary: Excel usefull formulas written in Ruby
data/.travis.yml DELETED
@@ -1,6 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.3.0
4
- - 2.2
5
- - 2.1
6
- before_install: gem install bundler -v 1.11.2
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "exonio"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here