module Holidays::CoreExtensions::Date
Public Class Methods
included(base)
click to toggle source
# File lib/holidays/core_extensions/date.rb, line 4 def self.included(base) base.extend ClassMethods end
Public Instance Methods
holiday?(*options)
click to toggle source
Check if the current date is a holiday.
Returns true or false.
Date.civil('2008-01-01').holiday?(:ca) => true
# File lib/holidays/core_extensions/date.rb, line 27 def holiday?(*options) holidays = self.holidays(options) holidays && !holidays.empty? end
holidays(*options)
click to toggle source
Get holidays on the current date.
Returns an array of hashes or nil. See Holidays#between for options and the output format.
Date.civil('2008-01-01').holidays(:ca_) => [{:name => 'New Year\'s Day',...}]
Also available via Holidays#on.
# File lib/holidays/core_extensions/date.rb, line 17 def holidays(*options) Holidays.on(self, options) end