take_home 1.0.2 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fy2022.rb +102 -0
  3. data/lib/take_home.rb +23 -23
  4. metadata +7 -7
  5. data/lib/fy2020.rb +0 -74
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d79f49b42977516577e8d3b206b9f961ac1f68afca4c53c48a4b85d54471207
4
- data.tar.gz: 82659ecf01463dd640eb89c5b24abc687dc0f6e1233f63a80c232cd05c9d97b1
3
+ metadata.gz: ec1c396419c97010891b90a300516d6b18549894804a0fd191e95d1018bc5e2d
4
+ data.tar.gz: '09016e191bb46a743f8043b9a7eef6dd965cd4b6b788d46fa9df055742bd7ec5'
5
5
  SHA512:
6
- metadata.gz: 42f191e68e83f6b3355de45beec28deceae9761c2a511a4166c0c95893db3e4fa7fddbb1afbf618539bb7d270f9cb75b02b838488d411eeb37e9ee7b208e07a8
7
- data.tar.gz: 43b0d3a8672b8695284205adeb515327a87e4211b7ab122401f762b1e8a46ac8a971d3d48f13429eb13ea75c6fb5360a77c71d3186606b93a7bcf8de08bc4e02
6
+ metadata.gz: f09ec46a91f7ec18679b87f2b4ffde1b18d6010c8e7da0b01e7d632b2e2bee128ca7a98b13d16d3ce048eb446075afb0f4f34dcdfba90adc1633e0fcba6654c0
7
+ data.tar.gz: a189d9d3b07b9602495c94b43bcee93612250d341e120bd66fce03e4195e6aecfc967f049ca55bec8ebc3eaf02f318301c4d43dfbdc813c2a05835953baeec86
data/lib/fy2022.rb ADDED
@@ -0,0 +1,102 @@
1
+ module TaxConstants
2
+ module FY2022
3
+ NO_DEDUCTION = 0
4
+ FEDERAL_SINGLE_STD_DEDUCTION = 12_950
5
+ FEDERAL_MARRIED_STD_DEDUCTION = 25_900
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
+
22
+ FEDERAL_SINGLE_INCOME_TAX_RATES = {
23
+ 10_275 => 0.10,
24
+ 41_775 => 0.12,
25
+ 89_075 => 0.22,
26
+ 170_050 => 0.24,
27
+ 215_950 => 0.32,
28
+ 539_900 => 0.35,
29
+ Float::INFINITY => 0.37
30
+ }
31
+
32
+ FEDERAL_MARRIED_INCOME_TAX_RATES = {
33
+ 20_550 => 0.10,
34
+ 83_550 => 0.12,
35
+ 178_150 => 0.22,
36
+ 340_100 => 0.24,
37
+ 431_900 => 0.32,
38
+ 647_850 => 0.35,
39
+ Float::INFINITY => 0.37
40
+ }
41
+
42
+ GEORGIA_SINGLE_STD_DEDUCTION = 5400
43
+ GEORGIA_MARRIED_STD_DEDUCTION = 7100
44
+
45
+ GEORGIA_SINGLE_INCOME_TAX_RATES = {
46
+ 750 => 0.01,
47
+ 2250 => 0.02,
48
+ 3750 => 0.03,
49
+ 5250 => 0.04,
50
+ 7000 => 0.05,
51
+ Float::INFINITY => 0.0575
52
+ }
53
+
54
+ GEORGIA_MARRIED_INCOME_TAX_RATES = {
55
+ 1000 => 0.01,
56
+ 3000 => 0.02,
57
+ 5000 => 0.03,
58
+ 7000 => 0.04,
59
+ 10_000 => 0.05,
60
+ Float::INFINITY => 0.0575
61
+ }
62
+
63
+ LOOKUP = {
64
+ single: {
65
+ federal: {
66
+ deduction: FEDERAL_SINGLE_STD_DEDUCTION,
67
+ rates: FEDERAL_SINGLE_INCOME_TAX_RATES,
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
+ },
77
+ georgia: {
78
+ deduction: GEORGIA_SINGLE_STD_DEDUCTION,
79
+ rates: GEORGIA_SINGLE_INCOME_TAX_RATES,
80
+ },
81
+ },
82
+ married: {
83
+ federal: {
84
+ deduction: FEDERAL_MARRIED_STD_DEDUCTION,
85
+ rates: FEDERAL_MARRIED_INCOME_TAX_RATES,
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
+ },
95
+ georgia: {
96
+ deduction: GEORGIA_MARRIED_STD_DEDUCTION,
97
+ rates: GEORGIA_MARRIED_INCOME_TAX_RATES,
98
+ },
99
+ }
100
+ }
101
+ end
102
+ end
data/lib/take_home.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative 'fy2020.rb'
1
+ require_relative 'fy2022.rb'
2
2
 
3
3
  class TaxablePerson
4
4
  attr_reader :income
@@ -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,14 +1,14 @@
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.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Wiseman
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-25 00:00:00.000000000 Z
11
+ date: 2022-12-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Help folks figure out their take home pay and taxes.
14
14
  email: patrick.wiseman@deft.services
@@ -16,13 +16,13 @@ executables: []
16
16
  extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
- - lib/fy2020.rb
19
+ - lib/fy2022.rb
20
20
  - lib/take_home.rb
21
21
  homepage: https://github.com/thephw/take_home
22
22
  licenses:
23
23
  - MIT
24
24
  metadata: {}
25
- post_install_message:
25
+ post_install_message:
26
26
  rdoc_options: []
27
27
  require_paths:
28
28
  - lib
@@ -37,8 +37,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
37
37
  - !ruby/object:Gem::Version
38
38
  version: '0'
39
39
  requirements: []
40
- rubygems_version: 3.0.3
41
- signing_key:
40
+ rubygems_version: 3.3.7
41
+ signing_key:
42
42
  specification_version: 4
43
43
  summary: Calculate take home pay and taxes
44
44
  test_files: []
data/lib/fy2020.rb DELETED
@@ -1,74 +0,0 @@
1
- module TaxConstants
2
- module FY2020
3
- SOCIAL_SECURITY_WAGE_BASE = 137_700
4
- SOCIAL_SECURITY_TAX_RATE = 0.062
5
- MEDICARE_TAX_RATE = 0.0145
6
-
7
- FEDERAL_SINGLE_STD_DEDUCTION = 12_200
8
- FEDERAL_MARRIED_STD_DEDUCTION = 24_400
9
-
10
- FEDERAL_SINGLE_INCOME_TAX_RATES = {
11
- 9700 => 0.10,
12
- 39_475 => 0.12,
13
- 84_200 => 0.22,
14
- 160_725 => 0.24,
15
- 204_100 => 0.32,
16
- 510_300 => 0.35,
17
- Float::INFINITY => 0.37
18
- }
19
-
20
- FEDERAL_MARRIED_INCOME_TAX_RATES = {
21
- 19_400 => 0.10,
22
- 78_950 => 0.12,
23
- 168_400 => 0.22,
24
- 321_450 => 0.24,
25
- 408_200 => 0.32,
26
- 612_350 => 0.35,
27
- Float::INFINITY => 0.37
28
- }
29
-
30
- GEORGIA_SINGLE_STD_DEDUCTION = 4600
31
- GEORGIA_MARRIED_STD_DEDUCTION = 6000
32
-
33
- GEORGIA_SINGLE_INCOME_TAX_RATES = {
34
- 750 => 0.01,
35
- 2250 => 0.02,
36
- 3750 => 0.03,
37
- 5250 => 0.04,
38
- 7000 => 0.05,
39
- Float::INFINITY => 0.0575
40
- }
41
-
42
- GEORGIA_MARRIED_INCOME_TAX_RATES = {
43
- 1000 => 0.01,
44
- 3000 => 0.02,
45
- 5000 => 0.03,
46
- 7000 => 0.04,
47
- 10_000 => 0.05,
48
- Float::INFINITY => 0.0575
49
- }
50
-
51
- LOOKUP = {
52
- single: {
53
- federal: {
54
- deduction: FEDERAL_SINGLE_STD_DEDUCTION,
55
- rates: FEDERAL_SINGLE_INCOME_TAX_RATES,
56
- },
57
- georgia: {
58
- deduction: GEORGIA_SINGLE_STD_DEDUCTION,
59
- rates: GEORGIA_SINGLE_INCOME_TAX_RATES,
60
- },
61
- },
62
- married: {
63
- federal: {
64
- deduction: FEDERAL_MARRIED_STD_DEDUCTION,
65
- rates: FEDERAL_MARRIED_INCOME_TAX_RATES,
66
- },
67
- georgia: {
68
- deduction: GEORGIA_MARRIED_STD_DEDUCTION,
69
- rates: GEORGIA_MARRIED_INCOME_TAX_RATES,
70
- },
71
- }
72
- }
73
- end
74
- end