business-days 0.0.2 → 0.0.3
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.
- checksums.yaml +4 -4
- data/lib/business-days.rb +6 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc274075629002d70301e7e805291871778dd331
|
4
|
+
data.tar.gz: 84911ef3242a3d587ba7451ed4623bb26a376d1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0689b65d2b4476bf66ce12ad3986c72711f8b4d70341895a734d7bef6277009405282f802f113a53b3acaac1163d5e1c11eb6c32516763a93c982a741777a0a9'
|
7
|
+
data.tar.gz: 0a2ba51641c4219655e1d2b09394995b48b666b79cdd7b878762c415b1bfa9d8ef3c4a6cd378e951f485f99ba3dd3e6777d5d6a7ffe25e2ac7a9a66cdd78e126
|
data/lib/business-days.rb
CHANGED
@@ -8,7 +8,6 @@ class BusinessDays
|
|
8
8
|
Holidays.between(Date.civil(Time.current.year,1,1), Date.civil(Time.current.year + 1, 12, 31), :br, :br).each do |holiday|
|
9
9
|
@@holidays.push(holiday[:date])
|
10
10
|
end
|
11
|
-
@@holidays.freeze
|
12
11
|
|
13
12
|
def business_days_from_utc_time(days, time)
|
14
13
|
# We count days based on Brasilia timezone
|
@@ -32,5 +31,11 @@ class BusinessDays
|
|
32
31
|
weekend = [6, 7].include?(date.cwday)
|
33
32
|
!(weekend || @@holidays.include?(date))
|
34
33
|
end
|
34
|
+
|
35
|
+
def add_holiday(date)
|
36
|
+
raise ArgumentError.new('Not a date') unless date.kind_of?(Date)
|
37
|
+
|
38
|
+
@@holidays.push(date)
|
39
|
+
end
|
35
40
|
end
|
36
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: business-days
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Allan Costa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|