active_warnings 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_warnings.rb +13 -6
- data/lib/active_warnings/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6377ec19d1daf91d25d3c24a16b414d99f427f77
|
4
|
+
data.tar.gz: a5a7cea71f84d2560407b8bc4661bd1421ee7b0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc5ec22bfedbc64d976ecf1470946189119d915e0946477421b94c0f0d66fbc698700901eeea07bdd0fdb8117ab895019aa6bdafe7fafd86a08ccf25c0958dec
|
7
|
+
data.tar.gz: 24900fdbd7de478b0c86c274e9323ae83fffd023791228f2ce352ace50cff4e4a229615a0e8e01e8f2783ed13ce1e98c40a572615e31305323686248f98f374f
|
data/lib/active_warnings.rb
CHANGED
@@ -47,17 +47,24 @@ module ActiveWarnings
|
|
47
47
|
@warnings ||= ActiveModel::Errors.new(self)
|
48
48
|
end
|
49
49
|
|
50
|
-
def
|
51
|
-
!
|
50
|
+
def unsafe?(context=nil)
|
51
|
+
!safe?(context)
|
52
52
|
end
|
53
|
-
alias_method :
|
53
|
+
alias_method :has_warnings?, :unsafe?
|
54
54
|
|
55
|
-
def
|
55
|
+
def safe?(context=nil)
|
56
|
+
with_warnings { valid?(context) }
|
57
|
+
end
|
58
|
+
alias_method :no_warnings?, :safe?
|
59
|
+
|
60
|
+
def with_warnings
|
56
61
|
@run_warning_validations = true
|
57
|
-
|
62
|
+
yield
|
58
63
|
ensure
|
59
64
|
@run_warning_validations = nil
|
60
65
|
end
|
61
|
-
alias_method :safe?, :no_warnings?
|
62
66
|
|
67
|
+
def with_warnings?
|
68
|
+
!!@run_warning_validations
|
69
|
+
end
|
63
70
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_warnings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Chung
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|