formulas 0.1.1 → 0.1.1.1

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: a7f8f146ead6fce0f64131ee26955ff1066d13300b3c73f81d7ea3cafb61c8be
4
- data.tar.gz: 1ac72a62a41f905d27c84cecd1da31ad434a632ba51110bc05242f0b3d8004c9
3
+ metadata.gz: 05cc76051c2d5ff9889d39b8448fe5b1b5fabdb60703b9b4c1afd9a58aa72a87
4
+ data.tar.gz: 01213c4a728219396108c266d8b4398d28829140957c4fb7e957ee401e20fd51
5
5
  SHA512:
6
- metadata.gz: a7d7ccbff597d9ca4b9fa5abac846235086e23d89b714e98cc85d7526cf54e42b6525158d8a294149b96403dc1e98ac6406ef0eecaa5800f8485d84bc92a7061
7
- data.tar.gz: 0c2e7a4e8a6ee19433ec5b337c38a90cf1f54e6112bebaf37ad5c34564c8d3509d313d8242e8b014bdfc9d50bde367c9beb63c5937ff3d10d7f29f667e0cdfe4
6
+ metadata.gz: 948b740e1a3e8965ab9991fdcf448081dfe896ff71fbd2f4f7fda2a98c356f37d2c741ef14ca19330168d5d93d211383659f1551fe0cc50b7bac74e5d5fde8bd
7
+ data.tar.gz: 8bc92d9ea8b509ce304afaeabfdf4db5d443d4a0a542ca8e4ffb34f71652fdec9f79941a3028df5096647a93c57c6c7937e6ea5d953fae82bb4fb8fe3e5e673a
data/formulas.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'formulas'
3
- s.version = '0.1.1'
3
+ s.version = '0.1.1.1'
4
4
  s.summary = "formulas"
5
5
  s.description = "Home loan formulas"
6
6
  s.authors = ["formulas"]
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Formulas
4
4
  # Calculate basic salary in frequency
5
- # salary = Formulas::Salary.new(gross_pay: 52_000, Salary::ANNUAL)
5
+ # salary = Formulas::Salary.new(pay: 52_000, Salary::ANNUAL)
6
6
  #
7
7
  # salary.pay(:monthly)
8
8
  #
@@ -15,19 +15,19 @@ module Formulas
15
15
  include FrequencyConversions
16
16
  attr_reader :frequency
17
17
 
18
- def initialize(gross_pay:, frequency:)
18
+ def initialize(pay:, frequency:)
19
19
  invalid_frequency unless FREQUENCIES.include?(frequency)
20
- raise ArgumentError, 'Gross pay must be numeric' unless Numeric === gross_pay
20
+ raise ArgumentError, 'Gross pay must be numeric' unless Numeric === pay
21
21
 
22
- @gross_pay = gross_pay
22
+ @pay = pay
23
23
  @frequency = frequency
24
24
  end
25
25
 
26
- def gross_pay(request_frequency: @frequency)
26
+ def pay(request_frequency: @frequency)
27
27
  invalid_frequency unless FREQUENCIES.include?(frequency)
28
- return @gross_pay if @frequency == request_frequency
28
+ return @pay if @frequency == request_frequency
29
29
 
30
- convert_gross_pay_to(request_frequency).round(2)
30
+ convert_pay_to(request_frequency).round(2)
31
31
  end
32
32
 
33
33
  private
@@ -36,8 +36,8 @@ module Formulas
36
36
  raise ArgumentError, "Invalid frequency, frequency are: #{FREQUENCIES.join(', ')}"
37
37
  end
38
38
 
39
- def convert_gross_pay_to(request_frequency)
40
- send("convert_#{@frequency}_to_#{request_frequency}", @gross_pay)
39
+ def convert_pay_to(request_frequency)
40
+ send("convert_#{@frequency}_to_#{request_frequency}", @pay)
41
41
  end
42
42
  end
43
43
  end
@@ -21,7 +21,7 @@ module Formulas
21
21
 
22
22
  def repayment
23
23
  selected_base = @repayment_threshold[@salary.frequency]
24
- less_base_cost = @salary.gross_pay - selected_base[0]
24
+ less_base_cost = @salary.pay - selected_base[0]
25
25
  ((FIX_RATE * less_base_cost * selected_base[1]) / 12).round(2)
26
26
  end
27
27
  end
@@ -24,7 +24,7 @@ module Formulas
24
24
  end
25
25
 
26
26
  def calculate(request_frequency: Formulas::ANNUALLY)
27
- result = @salary.gross_pay(request_frequency: request_frequency) * (@super.to_f / 100)
27
+ result = @salary.pay(request_frequency: request_frequency) * (@super.to_f / 100)
28
28
  result.round(2)
29
29
  end
30
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formulas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - formulas