Class: TaxCalculator::Deductions

Inherits:
Object
  • Object
show all
Defined in:
lib/tax_calculator/deductions.rb

Constant Summary collapse

STANDARD_DEDUCTION =
25_900

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(income, four_01_k, ira, hsa, health_premiums) ⇒ Deductions

Returns a new instance of Deductions.



9
10
11
12
13
14
# File 'lib/tax_calculator/deductions.rb', line 9

def initialize(income, four_01_k, ira, hsa, health_premiums)
  @federal = for_federal(income, four_01_k, ira, hsa, health_premiums)
  @fica = for_fica(income, hsa, health_premiums)
  @ohio = for_ohio(income, four_01_k, ira, hsa, health_premiums)
  @columbus = for_columbus(income, hsa, health_premiums)
end

Instance Attribute Details

#columbusObject (readonly)

Returns the value of attribute columbus.



7
8
9
# File 'lib/tax_calculator/deductions.rb', line 7

def columbus
  @columbus
end

#federalObject (readonly)

Returns the value of attribute federal.



7
8
9
# File 'lib/tax_calculator/deductions.rb', line 7

def federal
  @federal
end

#ficaObject (readonly)

Returns the value of attribute fica.



7
8
9
# File 'lib/tax_calculator/deductions.rb', line 7

def fica
  @fica
end

#ohioObject (readonly)

Returns the value of attribute ohio.



7
8
9
# File 'lib/tax_calculator/deductions.rb', line 7

def ohio
  @ohio
end

Instance Method Details

#for_columbus(income, hsa, health_premiums) ⇒ Object



30
31
32
# File 'lib/tax_calculator/deductions.rb', line 30

def for_columbus(income, hsa, health_premiums)
  income - (hsa + health_premiums)
end

#for_federal(income, four_01_k, ira, hsa, health_premiums) ⇒ Object



16
17
18
# File 'lib/tax_calculator/deductions.rb', line 16

def for_federal(income, four_01_k, ira, hsa, health_premiums)
  (income - (four_01_k + ira + hsa + health_premiums + STANDARD_DEDUCTION))
end

#for_fica(income, hsa, health_premiums) ⇒ Object



20
21
22
# File 'lib/tax_calculator/deductions.rb', line 20

def for_fica(income, hsa, health_premiums)
  (income - (hsa + health_premiums))
end

#for_ohio(income, four_01_k, ira, hsa, health_premiums) ⇒ Object



24
25
26
27
28
# File 'lib/tax_calculator/deductions.rb', line 24

def for_ohio(income, four_01_k, ira, hsa, health_premiums)
  num_exemptions = 2
  personal_exemption = 1_900 * num_exemptions
  (income - (four_01_k + ira + hsa + health_premiums + personal_exemption))
end