Class: Date

Inherits:
Object
  • Object
show all
Defined in:
lib/age_jp/core_ext/date.rb

Instance Method Summary collapse

Instance Method Details

#ageObject



2
3
4
# File 'lib/age_jp/core_ext/date.rb', line 2

def age
  AgeJp::Calculator.new(self).age_at
end

#age_at(date) ⇒ Object



6
7
8
# File 'lib/age_jp/core_ext/date.rb', line 6

def age_at(date)
  AgeJp::Calculator.new(self).age_at(date)
end

#age_jpObject



10
11
12
# File 'lib/age_jp/core_ext/date.rb', line 10

def age_jp
  AgeJp::Calculator.new(self).age_jp_at
end

#age_jp_at(date) ⇒ Object



14
15
16
# File 'lib/age_jp/core_ext/date.rb', line 14

def age_jp_at(date)
  AgeJp::Calculator.new(self).age_jp_at(date)
end

#east_asian_age_reckoningObject



18
19
20
# File 'lib/age_jp/core_ext/date.rb', line 18

def east_asian_age_reckoning
  AgeJp::Calculator.new(self).east_asian_age_reckoning_at
end

#east_asian_age_reckoning_at(date) ⇒ Object



22
23
24
# File 'lib/age_jp/core_ext/date.rb', line 22

def east_asian_age_reckoning_at(date)
  AgeJp::Calculator.new(self).east_asian_age_reckoning_at(date)
end

#insurance_ageObject



26
27
28
# File 'lib/age_jp/core_ext/date.rb', line 26

def insurance_age
  AgeJp::Calculator.new(self).insurance_age_at
end

#insurance_age_at(date) ⇒ Object



30
31
32
# File 'lib/age_jp/core_ext/date.rb', line 30

def insurance_age_at(date)
  AgeJp::Calculator.new(self).insurance_age_at(date)
end

#to_years_old_jp(n) ⇒ Object



36
37
38
39
40
# File 'lib/age_jp/core_ext/date.rb', line 36

def to_years_old_jp(n)
  return to_years_old(n).change(day: 28) if leap? && month == 2 && day == 29

  to_years_old(n).yesterday
end