Added missing PT definition files

This commit is contained in:
alexdunae 2010-03-04 00:09:14 -08:00
parent 3728992d4b
commit 7cbf7e5409
3 changed files with 12 additions and 42 deletions

View file

@ -3,6 +3,7 @@ The following definition files are included in this installation:
* holidays/au
* holidays/ca
* holidays/cz
* holidays/de
* holidays/dk
* holidays/es
@ -12,7 +13,6 @@ The following definition files are included in this installation:
* holidays/ie
* holidays/is
* holidays/it
* holidays/cz
* holidays/mx
* holidays/nl
* holidays/north_america

View file

@ -3,7 +3,7 @@ module Holidays
#
# Definitions loaded: data/pt.yaml
#
# To use the definitions in this file, load them right after you load the
# To use the definitions in this file, load them right after you load the
# Holiday gem:
#
# require 'holidays'
@ -11,28 +11,23 @@ module Holidays
#
# More definitions are available at http://code.dunae.ca/holidays.
module PT # :nodoc:
DEFINED_REGIONS = [:pt, :pt_br]
DEFINED_REGIONS = [:pt]
HOLIDAYS_BY_MONTH = {
5 => [{:mday => 1, :name => "Dia do Trabalhador", :regions => [:pt]}],
0 => [{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :type => :informal, :name => "Carnaval", :regions => [:pt, :pt_br]},
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Sexta-feira Santa", :regions => [:pt, :pt_br]},
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páscoa", :regions => [:pt, :pt_br]},
0 => [{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :type => :informal, :name => "Carnaval", :regions => [:pt]},
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Sexta-feira Santa", :regions => [:pt]},
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páscoa", :regions => [:pt]},
{:function => lambda { |year| Holidays.easter(year)+60 }, :function_id => "easter(year)+60", :name => "Corpo de Deus", :regions => [:pt]}],
11 => [{:mday => 1, :name => "Todos os Santos", :regions => [:pt]},
{:mday => 2, :name => "Finados", :regions => [:pt_br]},
{:mday => 15, :name => "Proclamação da República", :regions => [:pt_br]}],
11 => [{:mday => 1, :name => "Todos os Santos", :regions => [:pt]}],
6 => [{:mday => 10, :name => "Dia de Portugal", :regions => [:pt]}],
1 => [{:mday => 1, :name => "Ano Novo", :regions => [:pt]}],
12 => [{:mday => 1, :name => "Restauração da Independência", :regions => [:pt]},
{:mday => 8, :name => "Imaculada Conceição", :regions => [:pt]},
{:mday => 25, :name => "Natal", :regions => [:pt, :pt_br]}],
{:mday => 25, :name => "Natal", :regions => [:pt]}],
8 => [{:mday => 15, :name => "Assunção de Nossa Senhora", :regions => [:pt]}],
4 => [{:mday => 25, :name => "Dia da Liberdade", :regions => [:pt]},
{:mday => 21, :name => "Tiradentes", :regions => [:pt_br]}],
10 => [{:mday => 5, :name => "Implantação da República", :regions => [:pt]},
{:mday => 12, :name => "Nossa Senhora Aparecida", :regions => [:pt_br]}],
9 => [{:mday => 7, :name => "Independência do Brasil", :regions => [:pt_br]}]
4 => [{:mday => 25, :name => "Dia da Liberdade", :regions => [:pt]}],
10 => [{:mday => 5, :name => "Implantação da República", :regions => [:pt]}]
}
end
@ -40,4 +35,3 @@ module Holidays
end
Holidays.merge_defs(Holidays::PT::DEFINED_REGIONS, Holidays::PT::HOLIDAYS_BY_MONTH)

View file

@ -7,12 +7,12 @@ require 'holidays/pt'
class PtDefinitionTests < Test::Unit::TestCase # :nodoc:
def test_pt
{Date.civil(2008,1,1) => 'Ano Novo',
{Date.civil(2008,1,1) => 'Ano Novo',
Date.civil(2005,2,8) => 'Carnaval',
Date.civil(2006,2,28) => 'Carnaval',
Date.civil(2007,2,20) => 'Carnaval',
Date.civil(2008,2,5) => 'Carnaval',
Date.civil(2008,3,21) => 'Sexta-feira Santa',
Date.civil(2008,3,21) => 'Sexta-feira Santa',
Date.civil(2008,3,23) => 'Páscoa',
Date.civil(2008,4,25) => 'Dia da Liberdade',
Date.civil(2008,5,1) => 'Dia do Trabalhador',
@ -29,28 +29,4 @@ class PtDefinitionTests < Test::Unit::TestCase # :nodoc:
assert_equal name, Holidays.on(date, :pt, :informal)[0][:name]
end
end
def test_pt_br
{
Date.civil(2008,1,1) => 'Ano Novo',
Date.civil(2005,2,8) => 'Carnaval',
Date.civil(2006,2,28) => 'Carnaval',
Date.civil(2007,2,20) => 'Carnaval',
Date.civil(2008,3,21) => 'Sexta-feira Santa',
Date.civil(2008,3,23) => 'Páscoa',
Date.civil(2005,5,26) => 'Corpo de Deus',
Date.civil(2007,6,7) => 'Corpo de Deus',
Date.civil(2008,5,22) => 'Corpo de Deus',
Date.civil(2008,4,21) => 'Tiradentes',
Date.civil(2008,5,1) => 'Dia do Trabalhador',
Date.civil(2008,9,7) => 'Independência do Brasil',
Date.civil(2008,10,12) => 'Nossa Senhora Aparecida',
Date.civil(2008,11,2) => 'Finados',
Date.civil(2008,11,15) => 'Proclamação da República',
Date.civil(2008,12,25) => 'Natal'
}.each do |date, name|
assert_equal name, Holidays.on(date, :pt_br, :informal)[0][:name]
end
end
end