active_regulation 2.2.4 → 2.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3fc2bb1f1f44100294643edca82dec9b0f6eb48f
4
- data.tar.gz: 6e070d9bdb6c68e6bda282473b326682d74b0f88
3
+ metadata.gz: f3ca84f273ae42c7a002d385e2d49735ef7466a9
4
+ data.tar.gz: 41728d8e805a20925354cf5e23b32d5b9b99070a
5
5
  SHA512:
6
- metadata.gz: 7e41be266892964af1cb98249892d7bacf44f0fd2bf957d94e7b3043ebba5c2770c21402ac46ca0b6da60fe3eaa0135552d51a6ed01382b2d6968cdd39cd78eb
7
- data.tar.gz: 011b6671c3bac684868c5f128c69ae8a45caaf1029fb68ce563187055e6fee879ea609ba966ba0a6bcd3a1f3070c2d3cf4987950597c0cbfa0487f27e5002080
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!, unless: -> (obj) { obj.raw_activation.nil? }
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
- false_value = FALSE_VALUES.include?(activation)
40
- true_value = TRUE_VALUES.include?(activation)
41
-
42
- if false_value || true_value
43
- self.inactivated_at = (false_value ? Time.now : nil)
44
- else
45
- raise ArgumentError,
46
- "Unknown boolean: #{activation.inspect}. Must be a valid boolean."
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!, unless: -> (obj) { obj.raw_containment.nil? }
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
- false_value = FALSE_VALUES.include?(containment)
40
- true_value = TRUE_VALUES.include?(containment)
41
-
42
- if false_value || true_value
43
- self.contained_at = (false_value ? nil : Time.now)
44
- else
45
- raise ArgumentError,
46
- "Unknown boolean: #{containment.inspect}. Must be a valid boolean."
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!, unless: -> (obj) { obj.raw_expiration.nil? }
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
- false_value = FALSE_VALUES.include?(expiration)
50
- true_value = TRUE_VALUES.include?(expiration)
51
-
52
- if false_value || true_value
53
- self.expires_at = (false_value ? extension_date : nil)
54
- else
55
- raise ArgumentError,
56
- "Unknown boolean: #{expiration.inspect}. Must be a valid boolean."
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
 
@@ -1,3 +1,3 @@
1
1
  module ActiveRegulation
2
- VERSION = "2.2.4"
2
+ VERSION = "2.2.5"
3
3
  end
@@ -6,7 +6,7 @@ module ActiveRegulation
6
6
  included do
7
7
  attr_accessor :visibility, :raw_visibility
8
8
 
9
- before_save :record_visibility!, unless: -> (obj) { obj.raw_visibility.nil? }
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
- false_value = FALSE_VALUES.include?(visibility)
40
- true_value = TRUE_VALUES.include?(visibility)
41
-
42
- if false_value || true_value
43
- self.invisible_at = (false_value ? Time.now : nil)
44
- else
45
- raise ArgumentError,
46
- "Unknown boolean: #{visibility.inspect}. Must be a valid boolean."
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_regulation
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.4
4
+ version: 2.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez