active_regulation 2.2.3 → 2.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_regulation/activation.rb +4 -3
- data/lib/active_regulation/base.rb +8 -0
- data/lib/active_regulation/containment.rb +4 -3
- data/lib/active_regulation/expiration.rb +4 -3
- data/lib/active_regulation/version.rb +1 -1
- data/lib/active_regulation/visibility.rb +4 -3
- data/lib/active_regulation.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fc2bb1f1f44100294643edca82dec9b0f6eb48f
|
4
|
+
data.tar.gz: 6e070d9bdb6c68e6bda282473b326682d74b0f88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e41be266892964af1cb98249892d7bacf44f0fd2bf957d94e7b3043ebba5c2770c21402ac46ca0b6da60fe3eaa0135552d51a6ed01382b2d6968cdd39cd78eb
|
7
|
+
data.tar.gz: 011b6671c3bac684868c5f128c69ae8a45caaf1029fb68ce563187055e6fee879ea609ba966ba0a6bcd3a1f3070c2d3cf4987950597c0cbfa0487f27e5002080
|
@@ -1,11 +1,12 @@
|
|
1
1
|
module ActiveRegulation
|
2
2
|
module Activation
|
3
3
|
extend ActiveSupport::Concern
|
4
|
+
include ActiveRegulation::Base
|
4
5
|
|
5
6
|
included do
|
6
7
|
attr_accessor :activation, :raw_activation
|
7
8
|
|
8
|
-
before_save :record_activation!,
|
9
|
+
before_save :record_activation!, unless: -> (obj) { obj.raw_activation.nil? }
|
9
10
|
after_initialize :set_activation!
|
10
11
|
|
11
12
|
scope :active, -> { where(inactivated_at: nil) }
|
@@ -35,8 +36,8 @@ module ActiveRegulation
|
|
35
36
|
private
|
36
37
|
|
37
38
|
def record_activation!
|
38
|
-
false_value =
|
39
|
-
true_value =
|
39
|
+
false_value = FALSE_VALUES.include?(activation)
|
40
|
+
true_value = TRUE_VALUES.include?(activation)
|
40
41
|
|
41
42
|
if false_value || true_value
|
42
43
|
self.inactivated_at = (false_value ? Time.now : nil)
|
@@ -1,11 +1,12 @@
|
|
1
1
|
module ActiveRegulation
|
2
2
|
module Containment
|
3
3
|
extend ActiveSupport::Concern
|
4
|
+
include ActiveRegulation::Base
|
4
5
|
|
5
6
|
included do
|
6
7
|
attr_accessor :containment, :raw_containment
|
7
8
|
|
8
|
-
before_save :record_containment!,
|
9
|
+
before_save :record_containment!, unless: -> (obj) { obj.raw_containment.nil? }
|
9
10
|
after_initialize :set_containment!
|
10
11
|
|
11
12
|
scope :contained, -> { where.not(contained_at: nil) }
|
@@ -35,8 +36,8 @@ module ActiveRegulation
|
|
35
36
|
private
|
36
37
|
|
37
38
|
def record_containment!
|
38
|
-
false_value =
|
39
|
-
true_value =
|
39
|
+
false_value = FALSE_VALUES.include?(containment)
|
40
|
+
true_value = TRUE_VALUES.include?(containment)
|
40
41
|
|
41
42
|
if false_value || true_value
|
42
43
|
self.contained_at = (false_value ? nil : Time.now)
|
@@ -3,11 +3,12 @@ require 'date'
|
|
3
3
|
module ActiveRegulation
|
4
4
|
module Expiration
|
5
5
|
extend ActiveSupport::Concern
|
6
|
+
include ActiveRegulation::Base
|
6
7
|
|
7
8
|
included do
|
8
9
|
attr_accessor :expiration, :raw_expiration
|
9
10
|
|
10
|
-
before_save :record_expiration!,
|
11
|
+
before_save :record_expiration!, unless: -> (obj) { obj.raw_expiration.nil? }
|
11
12
|
after_initialize :set_expiration!
|
12
13
|
|
13
14
|
scope :expired, -> { where("expires_at IS NULL OR expires_at < ?", Time.now) }
|
@@ -45,8 +46,8 @@ module ActiveRegulation
|
|
45
46
|
end
|
46
47
|
|
47
48
|
def record_expiration!
|
48
|
-
false_value =
|
49
|
-
true_value =
|
49
|
+
false_value = FALSE_VALUES.include?(expiration)
|
50
|
+
true_value = TRUE_VALUES.include?(expiration)
|
50
51
|
|
51
52
|
if false_value || true_value
|
52
53
|
self.expires_at = (false_value ? extension_date : nil)
|
@@ -1,11 +1,12 @@
|
|
1
1
|
module ActiveRegulation
|
2
2
|
module Visibility
|
3
3
|
extend ActiveSupport::Concern
|
4
|
+
include ActiveRegulation::Base
|
4
5
|
|
5
6
|
included do
|
6
7
|
attr_accessor :visibility, :raw_visibility
|
7
8
|
|
8
|
-
before_save :record_visibility!,
|
9
|
+
before_save :record_visibility!, unless: -> (obj) { obj.raw_visibility.nil? }
|
9
10
|
after_initialize :set_visibility!
|
10
11
|
|
11
12
|
scope :visible, -> { where(invisible_at: nil) }
|
@@ -35,8 +36,8 @@ module ActiveRegulation
|
|
35
36
|
private
|
36
37
|
|
37
38
|
def record_visibility!
|
38
|
-
false_value =
|
39
|
-
true_value =
|
39
|
+
false_value = FALSE_VALUES.include?(visibility)
|
40
|
+
true_value = TRUE_VALUES.include?(visibility)
|
40
41
|
|
41
42
|
if false_value || true_value
|
42
43
|
self.invisible_at = (false_value ? Time.now : nil)
|
data/lib/active_regulation.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_regulation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -144,6 +144,7 @@ files:
|
|
144
144
|
- config/locales/en.yml
|
145
145
|
- lib/active_regulation.rb
|
146
146
|
- lib/active_regulation/activation.rb
|
147
|
+
- lib/active_regulation/base.rb
|
147
148
|
- lib/active_regulation/containment.rb
|
148
149
|
- lib/active_regulation/expiration.rb
|
149
150
|
- lib/active_regulation/version.rb
|