state_of_the_nation 1.1.5 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/state_of_the_nation.rb +20 -0
- data/lib/state_of_the_nation/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc3cdbd88385c581951562d576585cc78ff3528de59b908b280ad331c4794bc4
|
4
|
+
data.tar.gz: 4a41b1f65f1d1e517568deb529e1fdfaaae033a561d5b2d8b660a49588590c64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35dba604ed379b09913369ac0f59b14593c5c6fd40f7fa999733235a71b8ab5da41e9fb6a03e635fc04ab83535eb7699303723c3036cadac9c206208e2873a0c
|
7
|
+
data.tar.gz: 5a44d3263e9cafec224645750ae87e7e78faa7d85e27a5dbcc4e6a318658a1bdfec3da2554003fe6de712582a282341b655d2cbb8096385babf82603a2cad123
|
data/lib/state_of_the_nation.rb
CHANGED
@@ -30,6 +30,26 @@ module StateOfTheNation
|
|
30
30
|
(finish.blank? || round_if_should(finish) > round_if_should(time)) && round_if_should(start) <= round_if_should(time)
|
31
31
|
end
|
32
32
|
|
33
|
+
define_method "active_in_interval?" do |interval_start, interval_end|
|
34
|
+
record_start = round_if_should(start)
|
35
|
+
record_end = round_if_should(finish)
|
36
|
+
if ignore_empty && record_start == record_end
|
37
|
+
false
|
38
|
+
elsif interval_start.nil? && interval_end.nil?
|
39
|
+
true
|
40
|
+
elsif interval_start == interval_end
|
41
|
+
active?(interval_start)
|
42
|
+
elsif interval_start.nil?
|
43
|
+
record_start < interval_end
|
44
|
+
elsif interval_end.nil?
|
45
|
+
record_end.nil? || record_end > interval_start
|
46
|
+
elsif record_end.nil?
|
47
|
+
interval_end > record_start
|
48
|
+
else
|
49
|
+
record_start < interval_end && record_end > interval_start
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
33
53
|
scope :active, lambda { |time = Time.now.utc|
|
34
54
|
where(QueryString.query_for(:active_scope, self), round_if_should(time), round_if_should(time))
|
35
55
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: state_of_the_nation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick O'Doherty
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-03-
|
12
|
+
date: 2020-03-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|