Skip to content
This repository
Browse code

merging venezuelan holidays

  • Loading branch information...
commit 0a6163b63ded83676cb23f11ff5857cb1a9c58b6 2 parents c3dbba0 + d42ca99
hahahana authored March 12, 2013
1  data/index.yaml
@@ -37,3 +37,4 @@ defs:
37 37
   Scandinavia: ['dk.yaml', 'is.yaml', 'no.yaml', 'se.yaml', 'fi.yaml']
38 38
   Europe: ['at.yaml', 'ch.yaml', 'cz.yaml', 'dk.yaml', 'de.yaml', 'el.yaml', 'es.yaml', 'fr.yaml', 'gb.yaml', 'hr.yaml', 'hu.yaml', 'ie.yaml', 'is.yaml', 'it.yaml', 'li.yaml', 'nl.yaml', 'no.yaml', 'pl.yaml', 'pt.yaml']
39 39
   JP: ['jp.yaml']
  40
+  VE: ['ve.yaml']
70  data/ve.yaml
... ...
@@ -0,0 +1,70 @@
  1
+# Venezuela holiday definitions for the Ruby Holiday gem.
  2
+#
  3
+# Just including nonworking days nationally
  4
+#
  5
+# Updated: 2012-09-14.
  6
+# Source:  http://venciclopedia.com/index.php?title=D%C3%ADas_feriados_de_Venezuela
  7
+---
  8
+months:
  9
+  0:
  10
+  - name: Lunes Carnaval
  11
+    regions: [ve]
  12
+    function: easter(year)-48
  13
+  - name: Martes Carnaval
  14
+    regions: [ve]
  15
+    function: easter(year)-47
  16
+  - name: Jueves Santo
  17
+    regions: [ve]
  18
+    function: easter(year)-3
  19
+  - name: Viernes Santo
  20
+    regions: [ve]
  21
+    function: easter(year)-2
  22
+  1:
  23
+  - name: Año Nuevo
  24
+    regions: [ve]
  25
+    mday: 1
  26
+  4:
  27
+  - name: Declaración Independencia
  28
+    regions: [ve]
  29
+    mday: 19
  30
+  5:
  31
+  - name: Día del Trabajador
  32
+    regions: [ve]
  33
+    mday: 1
  34
+  6:
  35
+  - name: Aniversario Batalla de Carabobo
  36
+    regions: [ve]
  37
+    mday: 24
  38
+  7:
  39
+  - name: Día de la Independencia
  40
+    regions: [ve]
  41
+    mday: 5
  42
+  - name: Natalicio de Simón Bolívar
  43
+    regions: [ve]
  44
+    mday: 24
  45
+  10:
  46
+  - name: Día de la Resistencia Indígena
  47
+    regions: [ve]
  48
+    mday: 12
  49
+  12:
  50
+  - name: Día de Navidad
  51
+    regions: [ve]
  52
+    mday: 25
  53
+
  54
+tests: |
  55
+    {
  56
+    Date.civil(2013, 1, 1) => "Año Nuevo",
  57
+    Date.civil(2013, 2, 11) => "Lunes Carnaval",
  58
+    Date.civil(2013, 2, 12) => "Martes Carnaval",
  59
+    Date.civil(2013, 3, 28) => "Jueves Santo",
  60
+    Date.civil(2013, 3, 29) => "Viernes Santo",
  61
+    Date.civil(2013, 4, 19) => "Declaración Independencia",
  62
+    Date.civil(2013, 5, 1) => "Día del Trabajador",
  63
+    Date.civil(2013, 6, 24) => "Aniversario Batalla de Carabobo",
  64
+    Date.civil(2013, 7, 5) => "Día de la Independencia",
  65
+    Date.civil(2013, 7, 24) => "Natalicio de Simón Bolívar",
  66
+    Date.civil(2013, 10, 12) => "Día de la Resistencia Indígena",
  67
+    Date.civil(2013, 12, 25) => "Día de Navidad"
  68
+    }.each do |date, name|
  69
+      assert_equal name, (Holidays.on(date, :ve)[0] || {})[:name]
  70
+    end
49  lib/holidays/MANIFEST
... ...
@@ -1,37 +1,38 @@
1 1
 ==== Regional definitions
2 2
 The following definition files are included in this installation:
3 3
 
4  
-* holidays/is
5  
-* holidays/nyse
6  
-* holidays/us
7  
-* holidays/nz
8  
-* holidays/united_nations
9  
-* holidays/pl
10  
-* holidays/se
  4
+* holidays/za
11 5
 * holidays/it
12  
-* holidays/at
13  
-* holidays/no
14  
-* holidays/fr
  6
+* holidays/gb
  7
+* holidays/nyse
  8
+* holidays/dk
15 9
 * holidays/cz
16  
-* holidays/el
17  
-* holidays/north_america
18  
-* holidays/europe
19  
-* holidays/jp
20  
-* holidays/au
21  
-* holidays/ca
22  
-* holidays/de
23 10
 * holidays/ch
  11
+* holidays/ca
  12
+* holidays/is
  13
+* holidays/el
24 14
 * holidays/hu
25 15
 * holidays/ups
  16
+* holidays/europe
  17
+* holidays/scandinavia
  18
+* holidays/ve
  19
+* holidays/at
  20
+* holidays/nl
  21
+* holidays/pt
  22
+* holidays/br
  23
+* holidays/pl
26 24
 * holidays/fi
  25
+* holidays/de
27 26
 * holidays/es
  27
+* holidays/united_nations
  28
+* holidays/se
  29
+* holidays/jp
28 30
 * holidays/mx
  31
+* holidays/nz
  32
+* holidays/no
29 33
 * holidays/li
30  
-* holidays/gb
31 34
 * holidays/ie
32  
-* holidays/nl
33  
-* holidays/scandinavia
34  
-* holidays/pt
35  
-* holidays/za
36  
-* holidays/br
37  
-* holidays/dk
  35
+* holidays/north_america
  36
+* holidays/us
  37
+* holidays/au
  38
+* holidays/fr
40  lib/holidays/ve.rb
... ...
@@ -0,0 +1,40 @@
  1
+# encoding: utf-8
  2
+module Holidays
  3
+  # This file is generated by the Ruby Holidays gem.
  4
+  #
  5
+  # Definitions loaded: data/ve.yaml
  6
+  #
  7
+  # To use the definitions in this file, load it right after you load the 
  8
+  # Holiday gem:
  9
+  #
  10
+  #   require 'holidays'
  11
+  #   require 'holidays/ve'
  12
+  #
  13
+  # All the definitions are available at https://github.com/alexdunae/holidays
  14
+  module VE # :nodoc:
  15
+    def self.defined_regions
  16
+      [:ve]
  17
+    end
  18
+
  19
+    def self.holidays_by_month
  20
+      {
  21
+              0 => [{:function => lambda { |year| Holidays.easter(year)-48 }, :function_id => "easter(year)-48", :name => "Lunes Carnaval", :regions => [:ve]},
  22
+            {:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :name => "Martes Carnaval", :regions => [:ve]},
  23
+            {:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Jueves Santo", :regions => [:ve]},
  24
+            {:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Viernes Santo", :regions => [:ve]}],
  25
+      1 => [{:mday => 1, :name => "Año Nuevo", :regions => [:ve]}],
  26
+      4 => [{:mday => 19, :name => "Declaración Independencia", :regions => [:ve]}],
  27
+      5 => [{:mday => 1, :name => "Día del Trabajador", :regions => [:ve]}],
  28
+      6 => [{:mday => 24, :name => "Aniversario Batalla de Carabobo", :regions => [:ve]}],
  29
+      7 => [{:mday => 5, :name => "Día de la Independencia", :regions => [:ve]},
  30
+            {:mday => 24, :name => "Natalicio de Simón Bolívar", :regions => [:ve]}],
  31
+      10 => [{:mday => 12, :name => "Día de la Resistencia Indígena", :regions => [:ve]}],
  32
+      12 => [{:mday => 25, :name => "Día de Navidad", :regions => [:ve]}]
  33
+      }
  34
+    end
  35
+  end
  36
+
  37
+
  38
+end
  39
+
  40
+Holidays.merge_defs(Holidays::VE.defined_regions, Holidays::VE.holidays_by_month)
28  test/defs/test_defs_ve.rb
... ...
@@ -0,0 +1,28 @@
  1
+# encoding: utf-8
  2
+require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
  3
+
  4
+# This file is generated by the Ruby Holiday gem.
  5
+#
  6
+# Definitions loaded: data/ve.yaml
  7
+class VeDefinitionTests < Test::Unit::TestCase  # :nodoc:
  8
+
  9
+  def test_ve
  10
+{
  11
+Date.civil(2013, 1, 1) => "Año Nuevo",
  12
+Date.civil(2013, 2, 11) => "Lunes Carnaval",
  13
+Date.civil(2013, 2, 12) => "Martes Carnaval",
  14
+Date.civil(2013, 3, 28) => "Jueves Santo",
  15
+Date.civil(2013, 3, 29) => "Viernes Santo",
  16
+Date.civil(2013, 4, 19) => "Declaración Independencia",
  17
+Date.civil(2013, 5, 1) => "Día del Trabajador",
  18
+Date.civil(2013, 6, 24) => "Aniversario Batalla de Carabobo",
  19
+Date.civil(2013, 7, 5) => "Día de la Independencia",
  20
+Date.civil(2013, 7, 24) => "Natalicio de Simón Bolívar",
  21
+Date.civil(2013, 10, 12) => "Día de la Resistencia Indígena",
  22
+Date.civil(2013, 12, 25) => "Día de Navidad"
  23
+}.each do |date, name|
  24
+  assert_equal name, (Holidays.on(date, :ve)[0] || {})[:name]
  25
+end
  26
+
  27
+  end
  28
+end

0 notes on commit 0a6163b

Please sign in to comment.
Something went wrong with that request. Please try again.