Class: IncomeTax::Countries::Tanzania

Inherits:
Models::Progressive show all
Defined in:
lib/income_tax/countries/tanzania.rb

Constant Summary collapse

GROSS_PRESUMPTIVE =
20_000_000
NET_PRESUMPTIVE =
GROSS_PRESUMPTIVE - levels(:presumptive).calculate_gross(GROSS_PRESUMPTIVE)

Instance Attribute Summary

Attributes inherited from Models::Generic

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

Instance Method Summary collapse

Methods inherited from Models::Progressive

#calculate_gross, #calculate_net, level, levels, #levels, offset, remainder, tax_year, tax_years

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, #setup, #validate, wants_options

Constructor Details

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

Instance Method Details

#level_categoryObject



48
49
50
# File 'lib/income_tax/countries/tanzania.rb', line 48

def level_category
  presumptive? ? :presumptive : location
end

#set_default_optionsObject



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/income_tax/countries/tanzania.rb', line 36

def set_default_options
  options[:presumptive] = true  if options[:presumptive].nil?
  options[:presumptive] = false if gross_income and gross_income > GROSS_PRESUMPTIVE
  options[:presumptive] = false if net_income   and net_income   > NET_PRESUMPTIVE

  case location = options[:location].to_s.downcase
  when 'mainland', 'zanzibar' then options[:location] = location.to_sym
  when ''                     then options[:location] = :mainland
  else raise ArgumentError, 'location needs to be mainland or zanzibar'
  end
end