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
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_supportObject (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

#generalObject (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

#gradeObject

Returns the value of attribute grade.



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

def grade
  @grade
end

#particularObject (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

#salaryObject



45
46
47
# File 'lib/tax_jp/social_insurances/welfare_pension.rb', line 45

def salary
  @salary || monthly_standard
end

#valid_fromObject (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_untilObject (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_amountObject



29
30
31
# File 'lib/tax_jp/social_insurances/welfare_pension.rb', line 29

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

#general_amount_halfObject



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_amountObject



37
38
39
# File 'lib/tax_jp/social_insurances/welfare_pension.rb', line 37

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

#particular_amount_halfObject



41
42
43
# File 'lib/tax_jp/social_insurances/welfare_pension.rb', line 41

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