Class: IncomeTax::Countries::UnitedStates

Inherits:
Models::Generic show all
Defined in:
lib/income_tax/countries/united_states.rb,
lib/income_tax/countries/united_states/dc.rb,
lib/income_tax/countries/united_states/iowa.rb,
lib/income_tax/countries/united_states/ohio.rb,
lib/income_tax/countries/united_states/utah.rb,
lib/income_tax/countries/united_states/idaho.rb,
lib/income_tax/countries/united_states/maine.rb,
lib/income_tax/countries/united_states/state.rb,
lib/income_tax/countries/united_states/texas.rb,
lib/income_tax/countries/united_states/alaska.rb,
lib/income_tax/countries/united_states/hawaii.rb,
lib/income_tax/countries/united_states/kansas.rb,
lib/income_tax/countries/united_states/nevada.rb,
lib/income_tax/countries/united_states/oregon.rb,
lib/income_tax/countries/united_states/alabama.rb,
lib/income_tax/countries/united_states/arizona.rb,
lib/income_tax/countries/united_states/federal.rb,
lib/income_tax/countries/united_states/florida.rb,
lib/income_tax/countries/united_states/georgia.rb,
lib/income_tax/countries/united_states/indiana.rb,
lib/income_tax/countries/united_states/montana.rb,
lib/income_tax/countries/united_states/vermont.rb,
lib/income_tax/countries/united_states/wyoming.rb,
lib/income_tax/countries/united_states/arkansas.rb,
lib/income_tax/countries/united_states/colorado.rb,
lib/income_tax/countries/united_states/delaware.rb,
lib/income_tax/countries/united_states/illinois.rb,
lib/income_tax/countries/united_states/kentucky.rb,
lib/income_tax/countries/united_states/maryland.rb,
lib/income_tax/countries/united_states/michigan.rb,
lib/income_tax/countries/united_states/missouri.rb,
lib/income_tax/countries/united_states/nebraska.rb,
lib/income_tax/countries/united_states/new_york.rb,
lib/income_tax/countries/united_states/oklahoma.rb,
lib/income_tax/countries/united_states/virginia.rb,
lib/income_tax/countries/united_states/louisiana.rb,
lib/income_tax/countries/united_states/minnesota.rb,
lib/income_tax/countries/united_states/tennessee.rb,
lib/income_tax/countries/united_states/wisconsin.rb,
lib/income_tax/countries/united_states/california.rb,
lib/income_tax/countries/united_states/new_jersey.rb,
lib/income_tax/countries/united_states/new_mexico.rb,
lib/income_tax/countries/united_states/washington.rb,
lib/income_tax/countries/united_states/connecticut.rb,
lib/income_tax/countries/united_states/mississippi.rb,
lib/income_tax/countries/united_states/north_dakota.rb,
lib/income_tax/countries/united_states/pennsylvania.rb,
lib/income_tax/countries/united_states/rhode_island.rb,
lib/income_tax/countries/united_states/south_dakota.rb,
lib/income_tax/countries/united_states/massachusetts.rb,
lib/income_tax/countries/united_states/new_hampshire.rb,
lib/income_tax/countries/united_states/west_virginia.rb,
lib/income_tax/countries/united_states/north_carolina.rb,
lib/income_tax/countries/united_states/south_carolina.rb

Defined Under Namespace

Classes: Alabama, Alaska, Arizona, Arkansas, California, Colorado, Connecticut, Dc, Delaware, Federal, Florida, Georgia, Hawaii, Idaho, Illinois, Indiana, Iowa, Kansas, Kentucky, Louisiana, Maine, Maryland, Massachusetts, Michigan, Minnesota, Mississippi, Missouri, Montana, Nebraska, Nevada, NewHampshire, NewJersey, NewMexico, NewYork, NorthCarolina, NorthDakota, Ohio, Oklahoma, Oregon, Pennsylvania, RhodeIsland, SouthCarolina, SouthDakota, State, Tennessee, Texas, Utah, Vermont, Virginia, Washington, WestVirginia, Wisconsin, Wyoming

Constant Summary collapse

StateRegister =
Register.new("state")

Instance Attribute Summary

Attributes inherited from Models::Generic

#gross_income, #net_income, #options, #rate, #taxes

Instance Method Summary collapse

Methods inherited from Models::Generic

#based_on?, #cast_value, #cast_values, currency, #initialize, #inspect, lazy, #location_name, method_added, name, names, new, other_names, register, register_on, #set_default_options, #validate, wants_options

Constructor Details

This class inherits a constructor from IncomeTax::Models::Generic

Instance Method Details

#calculateObject



33
34
35
# File 'lib/income_tax/countries/united_states.rb', line 33

def calculate
  @taxes = federal_taxes + state_taxes
end

#federal_taxesObject



29
30
31
# File 'lib/income_tax/countries/united_states.rb', line 29

def federal_taxes
  @federal.taxes
end

#setup(**options) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/income_tax/countries/united_states.rb', line 9

def setup(**options)
  @federal = Federal.new(**options)

  if state?
    factory = StateRegister[state]

    if factory.deduct_federal?
      options[:income]      = @federal.net_income
      options[:income_type] = :gross
    end

    @state = factory.new(**options)
  end
end

#state_taxesObject



24
25
26
27
# File 'lib/income_tax/countries/united_states.rb', line 24

def state_taxes
  return 0 unless state?
  @state.taxes
end