Class: TaxJp::SocialInsurances::HealthInsurance
- Inherits:
-
Object
- Object
- TaxJp::SocialInsurances::HealthInsurance
- Defined in:
- lib/tax_jp/social_insurances/health_insurance.rb
Overview
健康保健
Instance Attribute Summary collapse
-
#basic ⇒ Object
readonly
Returns the value of attribute basic.
-
#care ⇒ Object
readonly
Returns the value of attribute care.
-
#general ⇒ Object
readonly
Returns the value of attribute general.
-
#grade ⇒ Object
readonly
Returns the value of attribute grade.
-
#particular ⇒ Object
readonly
Returns the value of attribute particular.
-
#prefecture ⇒ Object
readonly
Returns the value of attribute prefecture.
- #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_care ⇒ Object
- #general_amount_care_half ⇒ Object
- #general_amount_half ⇒ Object
-
#initialize(attrs) ⇒ HealthInsurance
constructor
A new instance of HealthInsurance.
Constructor Details
#initialize(attrs) ⇒ HealthInsurance
Returns a new instance of HealthInsurance.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/tax_jp/social_insurances/health_insurance.rb', line 11 def initialize(attrs) @salary = nil if attrs.is_a?(Hash) @grade = attrs[:grade] @valid_from = attrs[:valid_from] @valid_until = attrs[:valid_until] @prefecture = attrs[:prefecture] @general= attrs[:general] @care = attrs[:care] @particular= attrs[:particular] @basic = attrs[:basic] elsif attrs.is_a?(Array) @valid_from = attrs[0] @valid_until = attrs[1] @prefecture = attrs[2] @general= attrs[3] @care = attrs[4] @particular= attrs[5] @basic = attrs[6] end end |
Instance Attribute Details
#basic ⇒ Object (readonly)
Returns the value of attribute basic.
7 8 9 |
# File 'lib/tax_jp/social_insurances/health_insurance.rb', line 7 def basic @basic end |
#care ⇒ Object (readonly)
Returns the value of attribute care.
6 7 8 |
# File 'lib/tax_jp/social_insurances/health_insurance.rb', line 6 def care @care end |
#general ⇒ Object (readonly)
Returns the value of attribute general.
6 7 8 |
# File 'lib/tax_jp/social_insurances/health_insurance.rb', line 6 def general @general end |
#grade ⇒ Object (readonly)
Returns the value of attribute grade.
3 4 5 |
# File 'lib/tax_jp/social_insurances/health_insurance.rb', line 3 def grade @grade end |
#particular ⇒ Object (readonly)
Returns the value of attribute particular.
7 8 9 |
# File 'lib/tax_jp/social_insurances/health_insurance.rb', line 7 def particular @particular end |
#prefecture ⇒ Object (readonly)
Returns the value of attribute prefecture.
5 6 7 |
# File 'lib/tax_jp/social_insurances/health_insurance.rb', line 5 def prefecture @prefecture end |
#salary ⇒ Object
50 51 52 |
# File 'lib/tax_jp/social_insurances/health_insurance.rb', line 50 def salary @salary || monthly_standard end |
#valid_from ⇒ Object (readonly)
Returns the value of attribute valid_from.
4 5 6 |
# File 'lib/tax_jp/social_insurances/health_insurance.rb', line 4 def valid_from @valid_from end |
#valid_until ⇒ Object (readonly)
Returns the value of attribute valid_until.
4 5 6 |
# File 'lib/tax_jp/social_insurances/health_insurance.rb', line 4 def valid_until @valid_until end |
Instance Method Details
#general_amount ⇒ Object
34 35 36 |
# File 'lib/tax_jp/social_insurances/health_insurance.rb', line 34 def general_amount (salary * general).round(1) end |
#general_amount_care ⇒ Object
42 43 44 |
# File 'lib/tax_jp/social_insurances/health_insurance.rb', line 42 def general_amount_care (salary * (general + care)).round(1) end |
#general_amount_care_half ⇒ Object
46 47 48 |
# File 'lib/tax_jp/social_insurances/health_insurance.rb', line 46 def general_amount_care_half (general_amount_care / 2).floor(1) end |
#general_amount_half ⇒ Object
38 39 40 |
# File 'lib/tax_jp/social_insurances/health_insurance.rb', line 38 def general_amount_half (general_amount / 2).floor(1) end |