active_regulation 2.2.4 → 2.2.5
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3ca84f273ae42c7a002d385e2d49735ef7466a9
|
4
|
+
data.tar.gz: 41728d8e805a20925354cf5e23b32d5b9b99070a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abda366e0fc97cf382d195eced91de5aa8dc0bf0ddd9e81eb79311b62f0865300da6a984a2cc3d464634fa08f549c540675051c449365ae4e7190f6bf1b96cc8
|
7
|
+
data.tar.gz: d43dcf2b5d9b229bec79ea3eeda3ea743dd4660b76785a9c09be054f962c9d16ea5aacdd572b98b21b1b2a40e64c20311944615b1b280fa41485675e69fd7eb0
|
@@ -6,7 +6,7 @@ module ActiveRegulation
|
|
6
6
|
included do
|
7
7
|
attr_accessor :activation, :raw_activation
|
8
8
|
|
9
|
-
before_save :record_activation
|
9
|
+
before_save :record_activation!
|
10
10
|
after_initialize :set_activation!
|
11
11
|
|
12
12
|
scope :active, -> { where(inactivated_at: nil) }
|
@@ -36,14 +36,16 @@ module ActiveRegulation
|
|
36
36
|
private
|
37
37
|
|
38
38
|
def record_activation!
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
39
|
+
unless raw_activation.nil?
|
40
|
+
false_value = FALSE_VALUES.include?(activation)
|
41
|
+
true_value = TRUE_VALUES.include?(activation)
|
42
|
+
|
43
|
+
if false_value || true_value
|
44
|
+
self.inactivated_at = (false_value ? Time.now : nil)
|
45
|
+
else
|
46
|
+
raise ArgumentError,
|
47
|
+
"Unknown boolean: #{activation.inspect}. Must be a valid boolean."
|
48
|
+
end
|
47
49
|
end
|
48
50
|
end
|
49
51
|
|
@@ -6,7 +6,7 @@ module ActiveRegulation
|
|
6
6
|
included do
|
7
7
|
attr_accessor :containment, :raw_containment
|
8
8
|
|
9
|
-
before_save :record_containment
|
9
|
+
before_save :record_containment!
|
10
10
|
after_initialize :set_containment!
|
11
11
|
|
12
12
|
scope :contained, -> { where.not(contained_at: nil) }
|
@@ -36,14 +36,16 @@ module ActiveRegulation
|
|
36
36
|
private
|
37
37
|
|
38
38
|
def record_containment!
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
39
|
+
unless raw_containment.nil?
|
40
|
+
false_value = FALSE_VALUES.include?(containment)
|
41
|
+
true_value = TRUE_VALUES.include?(containment)
|
42
|
+
|
43
|
+
if false_value || true_value
|
44
|
+
self.contained_at = (false_value ? nil : Time.now)
|
45
|
+
else
|
46
|
+
raise ArgumentError,
|
47
|
+
"Unknown boolean: #{containment.inspect}. Must be a valid boolean."
|
48
|
+
end
|
47
49
|
end
|
48
50
|
end
|
49
51
|
|
@@ -8,7 +8,7 @@ module ActiveRegulation
|
|
8
8
|
included do
|
9
9
|
attr_accessor :expiration, :raw_expiration
|
10
10
|
|
11
|
-
before_save :record_expiration
|
11
|
+
before_save :record_expiration!
|
12
12
|
after_initialize :set_expiration!
|
13
13
|
|
14
14
|
scope :expired, -> { where("expires_at IS NULL OR expires_at < ?", Time.now) }
|
@@ -46,14 +46,16 @@ module ActiveRegulation
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def record_expiration!
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
49
|
+
unless raw_expiration.nil?
|
50
|
+
false_value = FALSE_VALUES.include?(expiration)
|
51
|
+
true_value = TRUE_VALUES.include?(expiration)
|
52
|
+
|
53
|
+
if false_value || true_value
|
54
|
+
self.expires_at = (false_value ? extension_date : nil)
|
55
|
+
else
|
56
|
+
raise ArgumentError,
|
57
|
+
"Unknown boolean: #{expiration.inspect}. Must be a valid boolean."
|
58
|
+
end
|
57
59
|
end
|
58
60
|
end
|
59
61
|
|
@@ -6,7 +6,7 @@ module ActiveRegulation
|
|
6
6
|
included do
|
7
7
|
attr_accessor :visibility, :raw_visibility
|
8
8
|
|
9
|
-
before_save :record_visibility
|
9
|
+
before_save :record_visibility!
|
10
10
|
after_initialize :set_visibility!
|
11
11
|
|
12
12
|
scope :visible, -> { where(invisible_at: nil) }
|
@@ -36,14 +36,16 @@ module ActiveRegulation
|
|
36
36
|
private
|
37
37
|
|
38
38
|
def record_visibility!
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
39
|
+
unless raw_visibility.nil?
|
40
|
+
false_value = FALSE_VALUES.include?(visibility)
|
41
|
+
true_value = TRUE_VALUES.include?(visibility)
|
42
|
+
|
43
|
+
if false_value || true_value
|
44
|
+
self.invisible_at = (false_value ? Time.now : nil)
|
45
|
+
else
|
46
|
+
raise ArgumentError,
|
47
|
+
"Unknown boolean: #{visibility.inspect}. Must be a valid boolean."
|
48
|
+
end
|
47
49
|
end
|
48
50
|
end
|
49
51
|
|