Module: VietnameseHoliday

Defined in:
lib/vietnamese_holiday.rb,
lib/vietnamese_holiday/utils.rb,
lib/vietnamese_holiday/version.rb

Overview

The Vietnamese Holiday

Defined Under Namespace

Modules: Utils Classes: Error

Constant Summary collapse

VERSION =
"0.1.8"

Class Method Summary collapse

Class Method Details

.between(from_date, to_date) ⇒ Object



31
32
33
34
35
36
37
38
# File 'lib/vietnamese_holiday.rb', line 31

def self.between(from_date, to_date)
  [].tap do |result|
    date_by_years = (Date.parse(from_date)..Date.parse(to_date)).group_by(&:year)
    date_by_years.each_value do |value|
      result.concat(Utils.holidays(value))
    end
  end
end

.check(date) ⇒ Object



15
16
17
# File 'lib/vietnamese_holiday.rb', line 15

def self.check(date)
  Utils.check(date)
end

.in_month(year, month) ⇒ Object



23
24
25
# File 'lib/vietnamese_holiday.rb', line 23

def self.in_month(year, month)
  Utils.holidays(Date.new(year, month).all_month)
end

.in_year(year) ⇒ Object



27
28
29
# File 'lib/vietnamese_holiday.rb', line 27

def self.in_year(year)
  Utils.holidays(Date.new(year).all_year)
end

.lunar_date(date) ⇒ Object



11
12
13
# File 'lib/vietnamese_holiday.rb', line 11

def self.lunar_date(date)
  Utils.lunar_date(date)
end

.name(date) ⇒ Object



19
20
21
# File 'lib/vietnamese_holiday.rb', line 19

def self.name(date)
  Utils.name(date)
end