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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/business-days.rb +6 -1
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b2484da50e64af95dcc87416da24e5526a4d9843
4
- data.tar.gz: 4dcd311c0d3e3756821790e69e45c060b39f7113
3
+ metadata.gz: fc274075629002d70301e7e805291871778dd331
4
+ data.tar.gz: 84911ef3242a3d587ba7451ed4623bb26a376d1c
5
5
  SHA512:
6
- metadata.gz: 102c023286bb5a584996e7e71fb26e477e515c58ddc6f640001b0302fb9bdb4069692dea34fd2b1f9d516b52bf7c1029cb2a58e8d2efcc67893655196d1ae494
7
- data.tar.gz: ceae93a8b93173a23db8aad3997de608b858df65d81c5aa4d7670b6c54611a2a339709c314175b273e0e3e848ad2332754e9307e0f7de9aa12098886df5eb8c6
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.2
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-08-11 00:00:00.000000000 Z
11
+ date: 2017-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport