Class: JPDate

Inherits:
Date
  • Object
show all
Defined in:
lib/jpdate.rb,
lib/jpdate/era.rb,
lib/jpdate/holiday.rb,
lib/jpdate/version.rb

Overview

日本の祝日と年号を出力するDateクラス(Dateを継承)

Example:

date = JPDate.parse('2014-9-23')
date.holiday    # => "秋分の日"
date.era        # => ["平成26年"]
date.short_era  # => ["H26"]

Defined Under Namespace

Modules: Era Classes: Holiday

Constant Summary collapse

VERSION =
"0.2"

Instance Method Summary collapse

Instance Method Details

#eraObject



18
19
20
# File 'lib/jpdate.rb', line 18

def era
  Era.name_year(year, month, day)
end

#holidayObject



14
15
16
# File 'lib/jpdate.rb', line 14

def holiday
  Holiday.name(self)
end

#short_eraObject



22
23
24
# File 'lib/jpdate.rb', line 22

def short_era
  Era.short_name_year(year, month, day)
end