active_warnings 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +8 -1
- data/README.md +18 -10
- data/active_warnings.gemspec +1 -2
- data/lib/active_warnings/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 946c4ca069857e523b766ec1a59a17e6312241c4
|
4
|
+
data.tar.gz: 89a230b5b5d9b99d95c4dbfc4880f682d4f34507
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 181e4c32e350b14a5e72c3d7df8e8422346d4f95b2b05e1b6ccd7921a2b0314f80467c5d641a902d0366516cea68058fd8a26ae3411ac717c9eb364030473112
|
7
|
+
data.tar.gz: 200be1d6c1ad4245b1e1b1c4b36c14e39a3ac52018c5d2f5c6f49bc7cd05353fe1a1835cd8ef5ac918899bf956e0a411e669fd54b2ca39f01613e51872af0269
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# ActiveWarnings
|
1
|
+
# ActiveWarnings [![Build Status](https://travis-ci.org/s12chung/active_warnings.svg?branch=test_active_model)](https://travis-ci.org/s12chung/active_warnings)
|
2
2
|
|
3
3
|
`ActiveModel::Validations` separate for warnings.
|
4
4
|
|
@@ -24,25 +24,33 @@ Or install it yourself as:
|
|
24
24
|
class BasicModel
|
25
25
|
include ActiveWarnings
|
26
26
|
|
27
|
-
attr_accessor :name
|
27
|
+
attr_accessor :name
|
28
|
+
def initialize(name); @name = name; end
|
28
29
|
|
29
30
|
validates :name, presence: true
|
30
31
|
|
31
32
|
warnings do
|
32
|
-
# to
|
33
|
-
#
|
34
|
-
validates :
|
33
|
+
# to share the same validators, error related methods now correspond to warnings. ie:
|
34
|
+
# the method #valid? == #safe? and #errors == #warnings
|
35
|
+
validates :name, absence: true
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
38
|
-
|
39
|
+
#
|
40
|
+
# Basic Use
|
41
|
+
#
|
42
|
+
model = BasicModel.new("some_name")
|
39
43
|
model.valid? # => true
|
40
44
|
model.errors.keys # => []
|
41
45
|
|
42
46
|
model.safe? # => false
|
43
47
|
model.no_warnings? # => false, equivalent to #safe?
|
44
|
-
model.
|
45
|
-
|
46
|
-
model.
|
47
|
-
|
48
|
+
model.unsafe? # => true
|
49
|
+
model.has_warnings? # => true, equivalent to #unsafe?
|
50
|
+
model.warnings.keys # => [:name]
|
51
|
+
|
52
|
+
#
|
53
|
+
# Advanced Use
|
54
|
+
#
|
55
|
+
model.using_warnings? # => false, is true in validators when calling #safe?
|
48
56
|
```
|
data/active_warnings.gemspec
CHANGED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
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.3
|
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-
|
11
|
+
date: 2015-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 4.1.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 4.1.0
|
27
27
|
description:
|
28
28
|
email:
|
29
29
|
- steve.chung7@gmail.com
|
@@ -64,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
64
|
version: '0'
|
65
65
|
requirements: []
|
66
66
|
rubyforge_project:
|
67
|
-
rubygems_version: 2.4.5
|
67
|
+
rubygems_version: 2.4.5.1
|
68
68
|
signing_key:
|
69
69
|
specification_version: 4
|
70
70
|
summary: Separate ActiveModel::Validations for warnings.
|