formulas 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/formulas.rb +64 -0
  3. metadata +71 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 689f6cec1e958e23dba5a41b2eb083aa812961657b4a011911374afe5fef20f6
4
+ data.tar.gz: e00de4f4bb6e815516a3cc8ece2c7ba8655921d56143a6a92d4e41b22abcdc90
5
+ SHA512:
6
+ metadata.gz: 0f3be3c409bce08fd1606ff9cde1da525353f5d1e25cf87c1083e7a13c592b6dd0c77c507f67bfa444add566f9fe3abab39aa0bcc85b2ffc8a2f2bed0bcb9892
7
+ data.tar.gz: 3e3e80e654b6f904342e0e87ba8c92e175c19f5d4e64b1670bba81c2325a8a8d0e8dd7ecf15c1c48234b25e9a8a4f916c3dd46f4f8a0a4cfd07c13534eff75d8
data/lib/formulas.rb ADDED
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Formulas
4
+ autoload :StudentLoanRepayment, './lib/formulas/student_loan_repayment'
5
+ autoload :Salary, './lib/formulas/salary'
6
+ autoload :PAYE, './lib/formulas/paye'
7
+ autoload :PAYG, './lib/formulas/payg'
8
+ autoload :Income, './lib/formulas/income'
9
+ autoload :WithholdingTax, './lib/formulas/withholding_tax'
10
+ autoload :Superannuation, './lib/formulas/superannuation'
11
+ autoload :LoanPrincipalCalculator, './lib/formulas/loan_principal_calculator'
12
+
13
+ MULTIPLIER_IN_FREQUENCY = {
14
+ weekly: 52,
15
+ fortnightly: 26,
16
+ four_weeks: 13,
17
+ monthly: 12
18
+ }
19
+
20
+ ANNUALLY = :annually
21
+ WEEKLY = :weekly
22
+ FORTNIGHTLY = :fortnightly
23
+ MONTHLY = :monthly
24
+
25
+ FREQUENCIES = [ANNUALLY, WEEKLY, FORTNIGHTLY, MONTHLY]
26
+
27
+ module FrequencyConversions
28
+ def convert_annually_to_weekly(number)
29
+ number.to_f / 52
30
+ end
31
+
32
+ def convert_annually_to_monthly(number)
33
+ number.to_f / 12
34
+ end
35
+
36
+ def convert_annually_to_fortnightly(number)
37
+ number.to_f / 26
38
+ end
39
+
40
+ def convert_weekly_to_annually(number)
41
+ number.to_f * 52
42
+ end
43
+
44
+ def convert_weekly_to_monthly(number)
45
+ number.to_f * 52 / 12
46
+ end
47
+
48
+ def convert_weekly_to_fortnightly(number)
49
+ number.to_f * 52 / 26
50
+ end
51
+
52
+ def convert_monthly_to_annually(number)
53
+ number.to_f * 12
54
+ end
55
+
56
+ def convert_monthly_to_weekly(number)
57
+ number.to_f * 12 / 52
58
+ end
59
+
60
+ def convert_monthly_to_fortnightly(number)
61
+ number.to_f * 12 / 26
62
+ end
63
+ end
64
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: formulas
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - formulas
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-07-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: minitest
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '5.8'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '5.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest-reporters
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '1.1'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '1.1'
41
+ description: Home loan formulas
42
+ email: ''
43
+ executables: []
44
+ extensions: []
45
+ extra_rdoc_files: []
46
+ files:
47
+ - lib/formulas.rb
48
+ homepage: https://rubygems.org/gems/formulas
49
+ licenses:
50
+ - MIT
51
+ metadata: {}
52
+ post_install_message:
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ requirements: []
67
+ rubygems_version: 3.0.9
68
+ signing_key:
69
+ specification_version: 4
70
+ summary: formulas
71
+ test_files: []