Module: HolidayCo
- Defined in:
- lib/holiday_co.rb,
lib/holiday_co/utils.rb,
lib/holiday_co/version.rb,
lib/holiday_co/models/day.rb,
lib/holiday_co/models/year.rb
Defined Under Namespace
Classes: Day, Year, YearDataNotAvailableError
Constant Summary
collapse
- UTC_OFFSET =
Colombian time zone is 5 hours behind UTC.
"-05:00".freeze
- VERSION =
"1.0.0"
Class Method Summary
collapse
Class Method Details
.current_date ⇒ Object
15
16
17
|
# File 'lib/holiday_co/utils.rb', line 15
def self.current_date
current_time.to_date
end
|
.current_time ⇒ Object
7
8
9
|
# File 'lib/holiday_co/utils.rb', line 7
def self.current_time
Time.now.getlocal(UTC_OFFSET)
end
|
.current_year ⇒ Object
11
12
13
|
# File 'lib/holiday_co/utils.rb', line 11
def self.current_year
current_time.year
end
|
.holidays(year = current_year) ⇒ Object
16
17
18
|
# File 'lib/holiday_co.rb', line 16
def holidays(year = current_year)
Year.new(year).holidays
end
|
.holidays_dates(year = current_year) ⇒ Object
24
25
26
|
# File 'lib/holiday_co.rb', line 24
def holidays_dates(year = current_year)
Year.new(year).holiday_dates
end
|
.holidays_names(year = current_year) ⇒ Object
20
21
22
|
# File 'lib/holiday_co.rb', line 20
def holidays_names(year = current_year)
Year.new(year).holiday_names
end
|
.is_holiday?(date = current_date) ⇒ Boolean
Also known as:
holiday?
10
11
12
|
# File 'lib/holiday_co.rb', line 10
def is_holiday?(date = current_date)
Day.new(date).holiday?
end
|