train-tax-calculator 2.2.1 → 2.2.2

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
  SHA1:
3
- metadata.gz: f4a162b90d20cf329a2ab7e4fb698c96812bda2c
4
- data.tar.gz: 0bae54b30eacaa90bb845b8865ec34c20e2425f1
3
+ metadata.gz: 6be25d58a16495863debdd71469a9f163ef350e3
4
+ data.tar.gz: 2d1419204944bd53465a11b75c93c1116cb06bd1
5
5
  SHA512:
6
- metadata.gz: 343cbd2bb9a9cb9bc6ec42daa774b12afd5c163b202504682895f27b9d92adea6afdbf58b2045fde4c0f9397fde61fe8045b35363f1ce080bf8729e5234e25ab
7
- data.tar.gz: da8535ad40bb339de5c84a87e48cc31a03d75518af99503b428cef3edca481a299ab61dec74fe8364776b6d9556fc1fda3fe51a90da29c7de2dcb883263114b2
6
+ metadata.gz: 3b1176e270784bb87072307719354a3b081c9f01432dc5eb8ab9f0124e4b7d677aed313c6ff51f3038f35582e58b7bf3f1b88d085b564d62f5fdd0b792569fb2
7
+ data.tar.gz: d59bb390586d8281ebfd7495bade04be0ab37864925ffa7a5e3b633c2885ecb469bebaad3a93b6f84f101593a065bb0e673eba03ebea8b1448516ee4b56c192a
data/Gemfile.lock CHANGED
@@ -6,7 +6,12 @@ PATH
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
+ coderay (1.1.2)
9
10
  diff-lcs (1.3)
11
+ method_source (0.9.0)
12
+ pry (0.11.3)
13
+ coderay (~> 1.1.0)
14
+ method_source (~> 0.9.0)
10
15
  rake (10.5.0)
11
16
  rspec (3.7.0)
12
17
  rspec-core (~> 3.7.0)
@@ -27,6 +32,7 @@ PLATFORMS
27
32
 
28
33
  DEPENDENCIES
29
34
  bundler (~> 1.16)
35
+ pry
30
36
  rake (~> 10.0)
31
37
  rspec (~> 3.0)
32
38
  train-tax-calculator!
@@ -16,7 +16,7 @@ module Train
16
16
  hash[:pagibig] = Pagibig.compute(basic_salary)
17
17
  hash[:philhealth] = Philhealth.compute(basic_salary)
18
18
  hash[:total_deductions] = Deductions.get(basic_salary)
19
- hash[:withholding_tax] = WithholdingTax.compute(hash[:total_deductions], basic_salary)
19
+ hash[:withholding_tax] = WithholdingTax.compute(basic_salary)
20
20
  hash[:net_income] = basic_salary - hash[:withholding_tax]
21
21
 
22
22
  hash
@@ -1,7 +1,7 @@
1
1
  module Train
2
2
  module Tax
3
3
  module Calculator
4
- VERSION = "2.2.1"
4
+ VERSION = "2.2.2"
5
5
  end
6
6
  end
7
7
  end
@@ -1,19 +1,19 @@
1
1
  module Train::Tax::Calculator
2
2
  module WithholdingTax
3
3
 
4
- TRAIN_TAX_TABLE = [
4
+ LOOKUP_TABLE = [
5
5
  { lowest: 0.00, highest: 20_833.00, base: 0.00, excess: 0.00 },
6
6
  { lowest: 20_833.00, highest: 33_333.00, base: 0.00, excess: 0.20 },
7
7
  { lowest: 33_333.00, highest: 66_667.00, base: 2_500.00, excess: 0.25 },
8
8
  { lowest: 66_667.000, highest: 166_667.00, base: 10_833.33, excess: 0.30 },
9
9
  { lowest: 166_667.00, highest: 666_667.00, base: 40_833.33, excess: 0.32 },
10
- { lowest: 666_667.00, highest: +1.00/0.00, base: 200_833.33, excess: 0.35 },
10
+ { lowest: 666_667.00, highest: Float::INFINITY, base: 200_833.33, excess: 0.35 },
11
11
  ]
12
12
 
13
- def self.compute(deductions, basic_salary)
14
- taxable_income = basic_salary - deductions
13
+ def self.compute(basic_salary)
14
+ taxable_income = basic_salary - Deductions.get(basic_salary)
15
15
 
16
- tax_bracket = TRAIN_TAX_TABLE.select do |bracket|
16
+ tax_bracket = LOOKUP_TABLE.select do |bracket|
17
17
  taxable_income >= bracket[:lowest] &&
18
18
  taxable_income < bracket[:highest]
19
19
  end.first
@@ -32,4 +32,5 @@ Gem::Specification.new do |spec|
32
32
  spec.add_development_dependency "bundler", "~> 1.16"
33
33
  spec.add_development_dependency "rake", "~> 10.0"
34
34
  spec.add_development_dependency "rspec", "~> 3.0"
35
+ spec.add_development_dependency "pry"
35
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: train-tax-calculator
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Chavez
@@ -55,6 +55,20 @@ dependencies:
55
55
  - - "~>"
56
56
  - !ruby/object:Gem::Version
57
57
  version: '3.0'
58
+ - !ruby/object:Gem::Dependency
59
+ name: pry
60
+ requirement: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ type: :development
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
58
72
  description: Computes withholding tax and net income
59
73
  email:
60
74
  - markchav3z@gmail.com