Class: IncomeTax::Countries::Switzerland

Inherits:
Models::Generic show all
Defined in:
lib/income_tax/countries/switzerland.rb,
lib/income_tax/countries/switzerland/uri.rb,
lib/income_tax/countries/switzerland/zug.rb,
lib/income_tax/countries/switzerland/bern.rb,
lib/income_tax/countries/switzerland/jura.rb,
lib/income_tax/countries/switzerland/vaud.rb,
lib/income_tax/countries/switzerland/aargau.rb,
lib/income_tax/countries/switzerland/canton.rb,
lib/income_tax/countries/switzerland/geneva.rb,
lib/income_tax/countries/switzerland/glarus.rb,
lib/income_tax/countries/switzerland/schwyz.rb,
lib/income_tax/countries/switzerland/ticino.rb,
lib/income_tax/countries/switzerland/valais.rb,
lib/income_tax/countries/switzerland/zurich.rb,
lib/income_tax/countries/switzerland/federal.rb,
lib/income_tax/countries/switzerland/grisons.rb,
lib/income_tax/countries/switzerland/lucerne.rb,
lib/income_tax/countries/switzerland/thurgau.rb,
lib/income_tax/countries/switzerland/fribourg.rb,
lib/income_tax/countries/switzerland/obwalden.rb,
lib/income_tax/countries/switzerland/neuchatel.rb,
lib/income_tax/countries/switzerland/nidwalden.rb,
lib/income_tax/countries/switzerland/solothurn.rb,
lib/income_tax/countries/switzerland/st_gallen.rb,
lib/income_tax/countries/switzerland/basel_city.rb,
lib/income_tax/countries/switzerland/basel_land.rb,
lib/income_tax/countries/switzerland/schaffhausen.rb,
lib/income_tax/countries/switzerland/appenzell_inner.rb,
lib/income_tax/countries/switzerland/appenzell_outer.rb

Defined Under Namespace

Classes: Aargau, AppenzellInner, AppenzellOuter, BaselCity, BaselLand, Bern, Canton, Federal, Fribourg, Geneva, Glarus, Grisons, Jura, Lucerne, Neuchatel, Nidwalden, Obwalden, Schaffhausen, Schwyz, Solothurn, StGallen, Thurgau, Ticino, Uri, Valais, Vaud, Zug, Zurich

Constant Summary collapse

CantonRegister =
Register.new('canton')

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



28
29
30
# File 'lib/income_tax/countries/switzerland.rb', line 28

def calculate
  @taxes = federal_taxes + cantonal_taxes + municipal_taxes
end

#cantonal_taxesObject



20
21
22
# File 'lib/income_tax/countries/switzerland.rb', line 20

def cantonal_taxes
  @canton.cantonal_multiplier * @canton.taxes
end

#federal_taxesObject



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

def federal_taxes
  @federal.taxes
end

#municipal_taxesObject



16
17
18
# File 'lib/income_tax/countries/switzerland.rb', line 16

def municipal_taxes
  @canton.municipal_multiplier * @canton.taxes
end

#setup(**options) ⇒ Object



11
12
13
14
# File 'lib/income_tax/countries/switzerland.rb', line 11

def setup(**options)
  @canton  = CantonRegister[options[:canton] || "ZH"].new(**options)
  @federal = Federal.new(**options)
end