take_home 1.0.2 → 1.0.3

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fy2020.rb +32 -4
  3. data/lib/take_home.rb +22 -22
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d79f49b42977516577e8d3b206b9f961ac1f68afca4c53c48a4b85d54471207
4
- data.tar.gz: 82659ecf01463dd640eb89c5b24abc687dc0f6e1233f63a80c232cd05c9d97b1
3
+ metadata.gz: 128ab59dc8bfa47dccb9c0748878775e47c99ab2fa0fb4e857e45f3b2591c8a9
4
+ data.tar.gz: 127bf4bb406629a7049eb7b6e934d10b55648a9cc5b9decacf1a59b218748cd7
5
5
  SHA512:
6
- metadata.gz: 42f191e68e83f6b3355de45beec28deceae9761c2a511a4166c0c95893db3e4fa7fddbb1afbf618539bb7d270f9cb75b02b838488d411eeb37e9ee7b208e07a8
7
- data.tar.gz: 43b0d3a8672b8695284205adeb515327a87e4211b7ab122401f762b1e8a46ac8a971d3d48f13429eb13ea75c6fb5360a77c71d3186606b93a7bcf8de08bc4e02
6
+ metadata.gz: 4be98428a21d300ffe94fdd9814c1bdcf67ec880f20c820afbed681519ddc158d70672aa911a7ace3c3e1e8342310d70dfed74c7fb88745575ffaf6f7125ba21
7
+ data.tar.gz: 23529cac0d9e6918266b8bb077067bcd28b79c27530c8c4ff16e3b7775194740ff8a28e9bd9d22c8ad77ce31c208ee8d9ae79de7536b2ccb037a78dcbd29ba95
@@ -1,12 +1,24 @@
1
1
  module TaxConstants
2
2
  module FY2020
3
- SOCIAL_SECURITY_WAGE_BASE = 137_700
4
- SOCIAL_SECURITY_TAX_RATE = 0.062
5
- MEDICARE_TAX_RATE = 0.0145
6
-
3
+ NO_DEDUCTION = 0
7
4
  FEDERAL_SINGLE_STD_DEDUCTION = 12_200
8
5
  FEDERAL_MARRIED_STD_DEDUCTION = 24_400
9
6
 
7
+ SOCIAL_SECURITY_TAX_RATES = {
8
+ 137_700 => 0.062,
9
+ Float::INFINITY => 0.0,
10
+ }
11
+
12
+ MEDICARE_SINGLE_TAX_RATES = {
13
+ 200_000 => 0.0145,
14
+ Float::INFINITY => 0.0235,
15
+ }
16
+
17
+ MEDICARE_MARRIED_TAX_RATES = {
18
+ 250_000 => 0.0145,
19
+ Float::INFINITY => 0.0235,
20
+ }
21
+
10
22
  FEDERAL_SINGLE_INCOME_TAX_RATES = {
11
23
  9700 => 0.10,
12
24
  39_475 => 0.12,
@@ -54,6 +66,14 @@ module TaxConstants
54
66
  deduction: FEDERAL_SINGLE_STD_DEDUCTION,
55
67
  rates: FEDERAL_SINGLE_INCOME_TAX_RATES,
56
68
  },
69
+ social_security: {
70
+ deduction: NO_DEDUCTION,
71
+ rates: SOCIAL_SECURITY_TAX_RATES,
72
+ },
73
+ medicare: {
74
+ deduction: NO_DEDUCTION,
75
+ rates: MEDICARE_SINGLE_TAX_RATES,
76
+ },
57
77
  georgia: {
58
78
  deduction: GEORGIA_SINGLE_STD_DEDUCTION,
59
79
  rates: GEORGIA_SINGLE_INCOME_TAX_RATES,
@@ -64,6 +84,14 @@ module TaxConstants
64
84
  deduction: FEDERAL_MARRIED_STD_DEDUCTION,
65
85
  rates: FEDERAL_MARRIED_INCOME_TAX_RATES,
66
86
  },
87
+ social_security: {
88
+ deduction: NO_DEDUCTION,
89
+ rates: SOCIAL_SECURITY_TAX_RATES,
90
+ },
91
+ medicare: {
92
+ deduction: NO_DEDUCTION,
93
+ rates: MEDICARE_MARRIED_TAX_RATES,
94
+ },
67
95
  georgia: {
68
96
  deduction: GEORGIA_MARRIED_STD_DEDUCTION,
69
97
  rates: GEORGIA_MARRIED_INCOME_TAX_RATES,
@@ -18,11 +18,11 @@ class TaxablePerson
18
18
  end
19
19
 
20
20
  def federal_income_taxes
21
- marginal_taxes(income, federal_deductions, federal_tax_rates)
21
+ marginal_taxes(income, federal_deduction, federal_tax_rates)
22
22
  end
23
23
 
24
24
  def state_income_taxes
25
- marginal_taxes(income, state_deductions, state_tax_rates)
25
+ marginal_taxes(income, state_deduction, state_tax_rates)
26
26
  end
27
27
 
28
28
  def payroll_taxes
@@ -30,15 +30,11 @@ class TaxablePerson
30
30
  end
31
31
 
32
32
  def social_security_taxes
33
- if income < social_security_wage_base
34
- taxes = income * social_security_tax_rate
35
- else
36
- taxes = social_security_wage_base * social_security_tax_rate
37
- end
33
+ marginal_taxes(income, social_security_deduction, social_security_tax_rates)
38
34
  end
39
35
 
40
36
  def medicare_taxes
41
- taxes = medicare_tax_rate * income
37
+ marginal_taxes(income, medicare_deduction, medicare_tax_rates)
42
38
  end
43
39
 
44
40
  def effective_tax_rate
@@ -56,20 +52,24 @@ class TaxablePerson
56
52
  attr_accessor :income
57
53
  attr_accessor :state_tax_rates
58
54
  attr_accessor :federal_tax_rates
59
- attr_accessor :medicare_tax_rate
60
- attr_accessor :social_security_tax_rate
61
- attr_accessor :social_security_wage_base
62
- attr_accessor :federal_deductions
63
- attr_accessor :state_deductions
55
+ attr_accessor :medicare_tax_rates
56
+ attr_accessor :social_security_tax_rates
57
+ attr_accessor :federal_deduction
58
+ attr_accessor :state_deduction
59
+ attr_accessor :social_security_deduction
60
+ attr_accessor :medicare_deduction
64
61
 
65
62
  def configure(opts)
66
- self.state_deductions = opts[:state_deductions] || TaxConstants::FY2020::LOOKUP[tax_type][state][:deduction]
67
- self.state_tax_rates = opts[:state_tax_rates] || TaxConstants::FY2020::LOOKUP[tax_type][state][:rates]
68
- self.federal_deductions = opts[:federal_deductions] || TaxConstants::FY2020::LOOKUP[tax_type][:federal][:deduction]
69
- self.federal_tax_rates = opts[:federal_tax_rates] || TaxConstants::FY2020::LOOKUP[tax_type][:federal][:rates]
70
- self.social_security_tax_rate = opts[:social_security_tax_rate] || TaxConstants::FY2020::SOCIAL_SECURITY_TAX_RATE
71
- self.social_security_wage_base = opts[:social_security_wage_base] || TaxConstants::FY2020::SOCIAL_SECURITY_WAGE_BASE
72
- self.medicare_tax_rate = opts[:medicare_tax_rate] || TaxConstants::FY2020::MEDICARE_TAX_RATE
63
+ constants = TaxConstants::FY2020::LOOKUP[tax_type]
64
+ self.state_tax_rates = opts[:state_tax_rates] || constants[state][:rates]
65
+ self.federal_tax_rates = opts[:federal_tax_rates] || constants[:federal][:rates]
66
+ self.social_security_tax_rates = opts[:social_security_tax_rate] || constants[:social_security][:rates]
67
+ self.medicare_tax_rates = opts[:medicare_tax_rate] || constants[:medicare][:rates]
68
+
69
+ self.federal_deduction = opts[:federal_deduction] || constants[:federal][:deduction]
70
+ self.state_deduction = opts[:state_deduction] || constants[state][:deduction]
71
+ self.social_security_deduction = opts[:social_security_deduction] || constants[:social_security][:deduction]
72
+ self.medicare_deduction = opts[:medicare_deduction] || constants[:medicare][:deduction]
73
73
  nil
74
74
  end
75
75
 
@@ -80,9 +80,9 @@ class TaxablePerson
80
80
  configure(opts)
81
81
  end
82
82
 
83
- def marginal_taxes(income, deductions, rates)
83
+ def marginal_taxes(income, deduction, rates)
84
84
  #Calculate AGI
85
- income = income - deductions
85
+ income = income - deduction
86
86
  #Calculate Income Taxes
87
87
  taxes = 0
88
88
  last_cap = 0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: take_home
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Wiseman