brdata 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/brdata.rb +11 -7
- data/lib/brdata/config/nacionais_fixos.yml +7 -1
- data/lib/brdata/version.rb +1 -1
- data/test/feriado_test.rb +33 -0
- metadata +3 -3
data/lib/brdata.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
+
# Load the rails application
|
2
3
|
$:.unshift(File.dirname(__FILE__)) unless
|
3
4
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
4
5
|
|
@@ -19,7 +20,6 @@ excecoes
|
|
19
20
|
|
20
21
|
module BrData
|
21
22
|
end
|
22
|
-
|
23
23
|
old_verbose = $VERBOSE
|
24
24
|
$VERBOSE = nil
|
25
25
|
[Time, Date].each do |clazz|
|
@@ -30,13 +30,17 @@ $VERBOSE = nil
|
|
30
30
|
end
|
31
31
|
$VERBOSE = old_verbose
|
32
32
|
|
33
|
-
# FERIADOS_PATH = RAILS_ROOT + '/config/feriados'
|
34
33
|
feriados, metodos = FeriadoParser.parser(File.dirname(__FILE__) + "/brdata/config")
|
35
|
-
|
36
|
-
#
|
37
|
-
|
38
|
-
|
39
|
-
|
34
|
+
|
35
|
+
# Verifica se existe arquivo de feriados na aplicação e carrega-os
|
36
|
+
FERIADOS_PATH = ""
|
37
|
+
FERIADOS_PATH = File.expand_path(File.split(APP_PATH)[0] + "/feriados", __FILE__) if defined?(APP_PATH)
|
38
|
+
if File.directory?(FERIADOS_PATH)
|
39
|
+
f, m = FeriadoParser.parser(FERIADOS_PATH)
|
40
|
+
feriados += f
|
41
|
+
metodos += m
|
42
|
+
end
|
43
|
+
|
40
44
|
Date::FERIADOS.clear
|
41
45
|
Date::FERIADOS_METODOS.clear
|
42
46
|
feriados.each { |f| Date::FERIADOS << f }
|
data/lib/brdata/version.rb
CHANGED
data/test/feriado_test.rb
CHANGED
@@ -23,6 +23,39 @@ class FeriadoTest < Test::Unit::TestCase
|
|
23
23
|
def test_feriado_quando_feriado_eh_corpus_christi
|
24
24
|
assert "07/06/2007".to_date.feriado?
|
25
25
|
end
|
26
|
+
|
27
|
+
# feriados nacionais
|
28
|
+
def test_confraternizacao_mundial
|
29
|
+
assert "01/01/2012".to_date.feriado?
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_tiradentes
|
33
|
+
assert "21/04/2012".to_date.feriado?
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_trabalho
|
37
|
+
assert "01/05/2012".to_date.feriado?
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_independencia
|
41
|
+
assert "07/09/2012".to_date.feriado?
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_finados
|
45
|
+
assert "02/11/2012".to_date.feriado?
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_republica
|
49
|
+
assert "15/11/2012".to_date.feriado?
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_natal
|
53
|
+
assert "25/12/2012".to_date.feriado?
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_padroeira_brasil
|
57
|
+
assert "12/10/2012".to_date.feriado?
|
58
|
+
end
|
26
59
|
|
27
60
|
# pascoa
|
28
61
|
def test_pascoa
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brdata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -15,7 +15,7 @@ authors:
|
|
15
15
|
autorequire:
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-09-20 00:00:00.000000000 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: actionpack
|
@@ -128,7 +128,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
128
128
|
version: '0'
|
129
129
|
segments:
|
130
130
|
- 0
|
131
|
-
hash:
|
131
|
+
hash: 2142947947427492410
|
132
132
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
133
|
none: false
|
134
134
|
requirements:
|