Class: HolidayJp::Holiday

Inherits:
Object
  • Object
show all
Defined in:
lib/holiday_jp/holiday.rb

Constant Summary collapse

WDAY_NAMES =
%w(      )
EN_HOLIDAY_NAMES =
{
  "元日" => "New Year's Day",
  "成人の日" => "Coming of Age Day",
  "建国記念の日" => "National Foundation Day",
  "春分の日" => "Vernal Equinox Day",
  "憲法記念日" => "Constitution Memorial Day",
  "みどりの日" => "Greenery Day",
  "こどもの日" => "Children's Day",
  "海の日" => "Marine Day",
  "山の日" => "Mountain Day",
  "敬老の日" => "Respect for the Aged Day",
  "秋分の日" => "Autumnal Equinox Day",
  "体育の日" => "Health and Sports Day",
  "スポーツの日" => "Sports Day",
  "文化の日" => "National Culture Day",
  "勤労感謝の日" => "Labor Thanksgiving Day",
  "天皇誕生日" => "Emperor's Birthday",
  "昭和の日" => "Showa Day",
  "振替休日" => "Holiday in lieu",
  "国民の休日" => "Citizen's Holiday",
  "即位礼正殿の儀" => "The Ceremony of the Enthronement of His Majesty th Emperor (at the Seiden)",
  "昭和天皇の大喪の礼" => "The Funeral Ceremony of Emperor Showa.",
  "皇太子徳仁親王の結婚の儀" => "The Rite of Wedding of HIH Crown Prince Naruhito"
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(date, name) ⇒ Holiday

Returns a new instance of Holiday.



35
36
37
38
# File 'lib/holiday_jp/holiday.rb', line 35

def initialize(date, name)
  @date = date
  @name = name
end

Instance Attribute Details

#dateObject (readonly)

Returns the value of attribute date.



33
34
35
# File 'lib/holiday_jp/holiday.rb', line 33

def date
  @date
end

#nameObject (readonly)

Returns the value of attribute name.



33
34
35
# File 'lib/holiday_jp/holiday.rb', line 33

def name
  @name
end

Instance Method Details

#name_enObject



40
41
42
# File 'lib/holiday_jp/holiday.rb', line 40

def name_en
  EN_HOLIDAY_NAMES[name]
end

#wday_nameObject Also known as: week



44
45
46
# File 'lib/holiday_jp/holiday.rb', line 44

def wday_name
  WDAY_NAMES[date.wday]
end