Class: IncomeTax::Models::Delegate
- Inherits:
-
Generic
- Object
- Generic
- IncomeTax::Models::Delegate
show all
- Defined in:
- lib/income_tax/models/delegate.rb
Instance Attribute Summary
Attributes inherited from Generic
#gross_income, #net_income, #options, #rate, #taxes
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from 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
Class Method Details
.delegate_to(base = nil) ⇒ Object
8
9
10
11
|
# File 'lib/income_tax/models/delegate.rb', line 8
def self.delegate_to(base = nil)
@delegate_to = base if base
@delegate_to ||= superclass.delegate_to
end
|
Instance Method Details
#calculate ⇒ Object
22
23
24
25
26
27
|
# File 'lib/income_tax/models/delegate.rb', line 22
def calculate
@rate = @delegate.rate
@taxes = @delegate.taxes
@net_income = @delegate.net_income
@gross_income = @delegate.gross_income
end
|
#delegate_to ⇒ Object
18
19
20
|
# File 'lib/income_tax/models/delegate.rb', line 18
def delegate_to
self.class.delegate_to
end
|
#setup(options) ⇒ Object
13
14
15
16
|
# File 'lib/income_tax/models/delegate.rb', line 13
def setup(options)
@delegate = delegate_to.new(**options)
super
end
|