Module: Holidays::NZ

Defined in:
lib/generated_definitions/nz.rb

Overview

This file is generated by the Ruby Holidays gem.

Definitions loaded: definitions/nz.yaml

To use the definitions in this file, load it right after you load the Holiday gem:

require 'holidays'
require 'generated_definitions/nz'

All the definitions are available at github.com/holidays/holidays

Class Method Summary collapse

Class Method Details

.custom_methodsObject


48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/generated_definitions/nz.rb', line 48

def self.custom_methods
  {
    "closest_monday(date)" => Proc.new { |date|
if [1, 2, 3, 4].include?(date.wday)
  date -= (date.wday - 1)
elsif 0 == date.wday
  date += 1
else
  date += 8 - date.wday
end
date
},

"previous_friday(date)" => Proc.new { |date|
date - 3
},

"next_week(date)" => Proc.new { |date|
date + 7
},


  }
end

.defined_regionsObject


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

def self.defined_regions
  [:nz, :nz_sl, :nz_we, :nz_ak, :nz_nl, :nz_ne, :nz_ot, :nz_ta, :nz_sc, :nz_hb, :nz_mb, :nz_ca, :nz_ch, :nz_wl]
end

.holidays_by_monthObject


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/generated_definitions/nz.rb', line 19

def self.holidays_by_month
  {
          0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Good Friday", :regions => [:nz]},
        {:function => "easter(year)", :function_arguments => [:year], :function_modifier => -1, :name => "Easter Saturday", :regions => [:nz]},
        {:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Easter Monday", :regions => [:nz]}],
  1 => [{:mday => 1, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "New Year's Day", :regions => [:nz]},
        {:mday => 2, :observed => "to_weekday_if_boxing_weekend(date)", :observed_arguments => [:date], :name => "Day after New Year's Day", :regions => [:nz]},
        {:mday => 17, :name => "Southland Anniversary Day", :regions => [:nz_sl]},
        {:mday => 22, :observed => "closest_monday(date)", :observed_arguments => [:date], :name => "Wellington Anniversary Day", :regions => [:nz_we]},
        {:mday => 29, :observed => "closest_monday(date)", :observed_arguments => [:date], :name => "Auckland Anniversary Day", :regions => [:nz_ak]},
        {:mday => 29, :observed => "closest_monday(date)", :observed_arguments => [:date], :name => "Northland Anniversary Day", :regions => [:nz_nl]}],
  2 => [{:mday => 1, :observed => "closest_monday(date)", :observed_arguments => [:date], :name => "Nelson Anniversary Day", :regions => [:nz_ne]},
        {:mday => 6, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Waitangi Day", :regions => [:nz]}],
  3 => [{:mday => 23, :observed => "closest_monday(date)", :observed_arguments => [:date], :name => "Otago Anniversary Day", :regions => [:nz_ot]},
        {:wday => 1, :week => 2, :observed => "closest_monday(date)", :observed_arguments => [:date], :name => "Taranaki Anniversary Day", :regions => [:nz_ta]}],
  4 => [{:mday => 25, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "ANZAC Day", :regions => [:nz]}],
  6 => [{:wday => 1, :week => 1, :name => "Queen's Birthday", :regions => [:nz]}],
  9 => [{:wday => 1, :week => 4, :name => "Dominion Day", :regions => [:nz_sc]}],
  10 => [{:wday => 1, :week => 1, :observed => "previous_friday(date)", :observed_arguments => [:date], :name => "Hawke's bay Anniversary Day", :regions => [:nz_hb]},
        {:wday => 1, :week => 4, :name => "Labour Day", :regions => [:nz]},
        {:wday => 1, :week => 4, :observed => "next_week(date)", :observed_arguments => [:date], :name => "Marlborough Anniversary Day", :regions => [:nz_mb]}],
  11 => [{:wday => 5, :week => 2, :name => "Canterbury Anniversary Day", :regions => [:nz_ca]},
        {:mday => 30, :observed => "closest_monday(date)", :observed_arguments => [:date], :name => "Chatham Island Anniversary Day", :regions => [:nz_ch]}],
  12 => [{:mday => 1, :observed => "closest_monday(date)", :observed_arguments => [:date], :name => "Westland Anniversary Day", :regions => [:nz_wl]},
        {:mday => 25, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Christmas Day", :regions => [:nz]},
        {:mday => 26, :observed => "to_weekday_if_boxing_weekend(date)", :observed_arguments => [:date], :name => "Boxing Day", :regions => [:nz]}]
  }
end