Module: HolidayJp
- Defined in:
- lib/holiday_jp.rb,
lib/holiday_jp/holiday.rb,
lib/holiday_jp/version.rb,
lib/holiday_jp/holidays.rb
Defined Under Namespace
Classes: Holiday
Constant Summary collapse
- VERSION =
"0.3.1"
- HOLIDAYS =
Class Method Summary collapse
-
.between(start, last) ⇒ Object
Between date === Example: >> holidays = HolidayJp.between(Date.new(2010, 9, 14), Date.new(2010, 9, 21)) >> holidays.first.name # 敬老の日 === parameters *
start
*last
. -
.holiday?(date) ⇒ Boolean
Whether the date is holiday or not.
Class Method Details
.between(start, last) ⇒ Object
Between date
Example:
>> holidays = HolidayJp.between(Date.new(2010, 9, 14), Date.new(2010, 9, 21))
>> holidays.first.name # 敬老の日
parameters
-
start
-
last
13 14 15 16 17 |
# File 'lib/holiday_jp.rb', line 13 def self.between(start, last) HOLIDAYS.find_all do |date, holiday| start <= date && date <= last end.map(&:last) end |
.holiday?(date) ⇒ Boolean
Whether the date is holiday or not.
Example:
>> HolidayJp.holiday?(Date.new(2011, 9, 19)) # => true
parameter(s)
-
date
25 26 27 |
# File 'lib/holiday_jp.rb', line 25 def self.holiday?(date) !HOLIDAYS[date].nil? end |