active_warnings 0.1.0 → 0.1.1

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: b2e4c511ee9a9519c3b062990f5a0c71d698fed2
4
- data.tar.gz: db9c49584e0fdcb03ed0f64a10dd249ad882aabd
3
+ metadata.gz: 6377ec19d1daf91d25d3c24a16b414d99f427f77
4
+ data.tar.gz: a5a7cea71f84d2560407b8bc4661bd1421ee7b0e
5
5
  SHA512:
6
- metadata.gz: 5e8dd7bf72dd7d055720b03f3110fc0adc2c1724972078316859baa5cd145fb4c495b9b5a14702a0b1b0e9bc80857b2e64f64ec70c8198fe579d19e38f13aa64
7
- data.tar.gz: 9eef7f281248db5d30eae3b25d54a090cc99514ee8a68d232a266fa85d0007f5dbe6245ba9dd4c597d884d847a4d09bc3a4121159462f76d5f97fd29311b5346
6
+ metadata.gz: fc5ec22bfedbc64d976ecf1470946189119d915e0946477421b94c0f0d66fbc698700901eeea07bdd0fdb8117ab895019aa6bdafe7fafd86a08ccf25c0958dec
7
+ data.tar.gz: 24900fdbd7de478b0c86c274e9323ae83fffd023791228f2ce352ace50cff4e4a229615a0e8e01e8f2783ed13ce1e98c40a572615e31305323686248f98f374f
@@ -47,17 +47,24 @@ module ActiveWarnings
47
47
  @warnings ||= ActiveModel::Errors.new(self)
48
48
  end
49
49
 
50
- def has_warnings?(context=nil)
51
- !no_warnings?(context)
50
+ def unsafe?(context=nil)
51
+ !safe?(context)
52
52
  end
53
- alias_method :unsafe?, :has_warnings?
53
+ alias_method :has_warnings?, :unsafe?
54
54
 
55
- def no_warnings?(context=nil)
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
- valid?(context)
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
@@ -1,3 +1,3 @@
1
1
  module ActiveWarnings
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  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.0
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-20 00:00:00.000000000 Z
11
+ date: 2015-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel