Class: TaxJp::SocialInsurances::WelfarePension
- Inherits:
-
Object
- Object
- TaxJp::SocialInsurances::WelfarePension
- Defined in:
- lib/tax_jp/social_insurances/welfare_pension.rb
Overview
ๅ็ๅนด้
Instance Attribute Summary collapse
-
#child_support ⇒ Object
readonly
Returns the value of attribute child_support.
-
#general ⇒ Object
readonly
Returns the value of attribute general.
-
#grade ⇒ Object
Returns the value of attribute grade.
-
#particular ⇒ Object
readonly
Returns the value of attribute particular.
- #salary ⇒ Object
-
#valid_from ⇒ Object
readonly
Returns the value of attribute valid_from.
-
#valid_until ⇒ Object
readonly
Returns the value of attribute valid_until.
Instance Method Summary collapse
- #general_amount ⇒ Object
- #general_amount_half ⇒ Object
-
#initialize(attrs) ⇒ WelfarePension
constructor
A new instance of WelfarePension.
- #particular_amount ⇒ Object
- #particular_amount_half ⇒ Object
Constructor Details
#initialize(attrs) ⇒ WelfarePension
Returns a new instance of WelfarePension.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/tax_jp/social_insurances/welfare_pension.rb', line 10 def initialize(attrs) @salary = nil if attrs.is_a?(Hash) @grade = attrs[:grade] @valid_from = attrs[:valid_from] @valid_until = attrs[:valid_until] @general= attrs[:general] @particular= attrs[:particular] @child_support = attrs[:child_support] elsif attrs.is_a?(Array) @valid_from = attrs[0] @valid_until = attrs[1] @general= attrs[2] @particular= attrs[3] @child_support = attrs[4] end end |
Instance Attribute Details
#child_support ⇒ Object (readonly)
Returns the value of attribute child_support.
5 6 7 |
# File 'lib/tax_jp/social_insurances/welfare_pension.rb', line 5 def child_support @child_support end |
#general ⇒ Object (readonly)
Returns the value of attribute general.
4 5 6 |
# File 'lib/tax_jp/social_insurances/welfare_pension.rb', line 4 def general @general end |
#grade ⇒ Object
Returns the value of attribute grade.
7 8 9 |
# File 'lib/tax_jp/social_insurances/welfare_pension.rb', line 7 def grade @grade end |
#particular ⇒ Object (readonly)
Returns the value of attribute particular.
4 5 6 |
# File 'lib/tax_jp/social_insurances/welfare_pension.rb', line 4 def particular @particular end |
#salary ⇒ Object
45 46 47 |
# File 'lib/tax_jp/social_insurances/welfare_pension.rb', line 45 def salary @salary || monthly_standard end |
#valid_from ⇒ Object (readonly)
Returns the value of attribute valid_from.
3 4 5 |
# File 'lib/tax_jp/social_insurances/welfare_pension.rb', line 3 def valid_from @valid_from end |
#valid_until ⇒ Object (readonly)
Returns the value of attribute valid_until.
3 4 5 |
# File 'lib/tax_jp/social_insurances/welfare_pension.rb', line 3 def valid_until @valid_until end |
Instance Method Details
#general_amount ⇒ Object
29 30 31 |
# File 'lib/tax_jp/social_insurances/welfare_pension.rb', line 29 def general_amount (salary * general).round(2) end |
#general_amount_half ⇒ Object
33 34 35 |
# File 'lib/tax_jp/social_insurances/welfare_pension.rb', line 33 def general_amount_half (general_amount / 2).floor(2) end |
#particular_amount ⇒ Object
37 38 39 |
# File 'lib/tax_jp/social_insurances/welfare_pension.rb', line 37 def particular_amount (salary * particular).round(2) end |
#particular_amount_half ⇒ Object
41 42 43 |
# File 'lib/tax_jp/social_insurances/welfare_pension.rb', line 41 def particular_amount_half (particular_amount / 2).floor(2) end |