business_calendar 3.0.0 → 3.0.1
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7b390e3954573c98a996c9839374b3f2802f3ecb81d0815f62d28fc36b294c62
|
|
4
|
+
data.tar.gz: 7b5aeebc620e1c5c80b70a3359cb01cef43e7d27c3ca0778d7e13eeab5f17c58
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 975c687a0f0ea409e5c6a97116fe00807a2b14d4bfb85a9a43a575ce07549b30fa11f7ca2bd3b417f560df53842e450a24d1c564dbabf1481974bac77f4e2a98
|
|
7
|
+
data.tar.gz: bf9427e07ab653c90537a41b8f2b4e9cb95b09d9ec407c764b6b6fc9e3aa12037f1934c9cfe389626419f35e187578555681880a074efeeff49ae7e91590d90a
|
|
@@ -2,7 +2,7 @@ require 'holidays'
|
|
|
2
2
|
|
|
3
3
|
class BusinessCalendar::HolidayDeterminer
|
|
4
4
|
DEFAULT_TIME_TO_LIVE = 24 * 60 * 60
|
|
5
|
-
attr_reader :regions, :holiday_names, :
|
|
5
|
+
attr_reader :regions, :holiday_names, :additions_only
|
|
6
6
|
|
|
7
7
|
def initialize(regions, holiday_names, opts = {})
|
|
8
8
|
ttl = opts[:ttl]
|
|
@@ -27,6 +27,14 @@ class BusinessCalendar::HolidayDeterminer
|
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
+
def additions
|
|
31
|
+
@additions_cache ||= @additions.is_a?(Proc) ? @additions.call : @additions
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def removals
|
|
35
|
+
@removals_cache ||= @removals.is_a?(Proc) ? @removals.call : @removals
|
|
36
|
+
end
|
|
37
|
+
|
|
30
38
|
private
|
|
31
39
|
|
|
32
40
|
def should_clear_cache?
|
|
@@ -40,12 +48,4 @@ class BusinessCalendar::HolidayDeterminer
|
|
|
40
48
|
@additions_cache = nil
|
|
41
49
|
@removals_cache = nil
|
|
42
50
|
end
|
|
43
|
-
|
|
44
|
-
def additions
|
|
45
|
-
@additions_cache ||= @additions.is_a?(Proc) ? @additions.call : @additions
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def removals
|
|
49
|
-
@removals_cache ||= @removals.is_a?(Proc) ? @removals.call : @removals
|
|
50
|
-
end
|
|
51
51
|
end
|
|
@@ -47,5 +47,9 @@ describe BusinessCalendar::HolidayDeterminer do
|
|
|
47
47
|
it "correctly determines false for dates not in additions, nor exceptions" do
|
|
48
48
|
expect(subject.call('2101-07-04'.to_date)).to be_falsy
|
|
49
49
|
end
|
|
50
|
+
|
|
51
|
+
it "lists out the additions" do
|
|
52
|
+
expect(subject.additions).to include('2101-07-05'.to_date)
|
|
53
|
+
end
|
|
50
54
|
end
|
|
51
55
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: business_calendar
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0.
|
|
4
|
+
version: 3.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Robert Nubel
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-03-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: holidays
|