Class: TaxJp::SocialInsurances::WelfarePension

Inherits:
Object
  • Object
show all
Defined in:
lib/tax_jp/social_insurances/welfare_pension.rb

Overview

厚生年金

Instance Attribute Summary collapse

Instance Method Summary collapse

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
# File 'lib/tax_jp/social_insurances/welfare_pension.rb', line 10

def initialize(attrs)
  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_supportObject (readonly)

Returns the value of attribute child_support.



6
7
8
# File 'lib/tax_jp/social_insurances/welfare_pension.rb', line 6

def child_support
  @child_support
end

#generalObject (readonly)

Returns the value of attribute general.



5
6
7
# File 'lib/tax_jp/social_insurances/welfare_pension.rb', line 5

def general
  @general
end

#gradeObject (readonly)

Returns the value of attribute grade.



3
4
5
# File 'lib/tax_jp/social_insurances/welfare_pension.rb', line 3

def grade
  @grade
end

#particularObject (readonly)

Returns the value of attribute particular.



5
6
7
# File 'lib/tax_jp/social_insurances/welfare_pension.rb', line 5

def particular
  @particular
end

#salaryObject

Returns the value of attribute salary.



8
9
10
# File 'lib/tax_jp/social_insurances/welfare_pension.rb', line 8

def salary
  @salary
end

#valid_fromObject (readonly)

Returns the value of attribute valid_from.



4
5
6
# File 'lib/tax_jp/social_insurances/welfare_pension.rb', line 4

def valid_from
  @valid_from
end

#valid_untilObject (readonly)

Returns the value of attribute valid_until.



4
5
6
# File 'lib/tax_jp/social_insurances/welfare_pension.rb', line 4

def valid_until
  @valid_until
end

Instance Method Details

#general_amountObject



27
28
29
# File 'lib/tax_jp/social_insurances/welfare_pension.rb', line 27

def general_amount
  (salary * general).round(2) 
end

#general_amount_halfObject



31
32
33
# File 'lib/tax_jp/social_insurances/welfare_pension.rb', line 31

def general_amount_half
  (general_amount / 2).floor(2)
end

#particular_amountObject



35
36
37
# File 'lib/tax_jp/social_insurances/welfare_pension.rb', line 35

def particular_amount
  (salary * particular).round(2) 
end

#particular_amount_halfObject



39
40
41
# File 'lib/tax_jp/social_insurances/welfare_pension.rb', line 39

def particular_amount_half
  (particular_amount / 2).floor(2) 
end