Class: VerifiedHolidays::Holiday
- Inherits:
-
Object
- Object
- VerifiedHolidays::Holiday
- Defined in:
- lib/verified_holidays/holiday.rb
Constant Summary collapse
- WDAY_NAMES =
%w[日 月 火 水 木 金 土].freeze
- EN_HOLIDAY_NAMES =
{ '元日' => "New Year's Day", '成人の日' => 'Coming of Age Day', '建国記念の日' => 'National Foundation Day', '天皇誕生日' => "Emperor's Birthday", '春分の日' => 'Vernal Equinox Day', '昭和の日' => 'Showa Day', '憲法記念日' => 'Constitution Memorial Day', 'みどりの日' => 'Greenery Day', 'こどもの日' => "Children's Day", '海の日' => 'Marine Day', '山の日' => 'Mountain Day', '敬老の日' => 'Respect for the Aged Day', '秋分の日' => 'Autumnal Equinox Day', 'スポーツの日' => 'Sports Day', '文化の日' => 'Culture Day', '勤労感謝の日' => 'Labor Thanksgiving Day', '振替休日' => 'Substitute Holiday', '休日' => "Citizens' Holiday", '体育の日' => 'Health and Sports Day', '国民の休日' => "Citizens' Holiday", '即位礼正殿の儀の行われる日' => 'Enthronement Ceremony', '即位の日' => 'Enthronement Day', '天皇の即位の日及び即位礼正殿の儀の行われる日を休日とする法律' => 'Holiday by Law', 'みどりの日(国民の休日)' => "Greenery Day (Citizens' Holiday)", }.freeze
Instance Attribute Summary collapse
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(date, name) ⇒ Holiday
constructor
A new instance of Holiday.
- #name_en ⇒ Object
- #wday_name ⇒ Object (also: #week)
Constructor Details
#initialize(date, name) ⇒ Holiday
Returns a new instance of Holiday.
36 37 38 39 |
# File 'lib/verified_holidays/holiday.rb', line 36 def initialize(date, name) @date = date @name = name end |
Instance Attribute Details
#date ⇒ Object (readonly)
Returns the value of attribute date.
34 35 36 |
# File 'lib/verified_holidays/holiday.rb', line 34 def date @date end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
34 35 36 |
# File 'lib/verified_holidays/holiday.rb', line 34 def name @name end |
Instance Method Details
#name_en ⇒ Object
41 42 43 |
# File 'lib/verified_holidays/holiday.rb', line 41 def name_en EN_HOLIDAY_NAMES[name] end |
#wday_name ⇒ Object Also known as: week
45 46 47 |
# File 'lib/verified_holidays/holiday.rb', line 45 def wday_name WDAY_NAMES[date.wday] end |