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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3187048552ec6736d66f4d7cd5745b6380f1efc7
4
- data.tar.gz: e65380ae6eadca11f13d1759fe8636fb54a38022
3
+ metadata.gz: 946c4ca069857e523b766ec1a59a17e6312241c4
4
+ data.tar.gz: 89a230b5b5d9b99d95c4dbfc4880f682d4f34507
5
5
  SHA512:
6
- metadata.gz: 14ad7b0873b4fcac5774d51e6b77809e41b87da2feb0323b5356f51a331e56da6b2e8be45d6723ab7faefdba16ca970fb096e42b050f73b6fe77f19b8f8c6c64
7
- data.tar.gz: 69db322b781c0118994613821ce2c2ceae90a556662d1140d59fbf711c7d70d5febb8e7d64df7c6a7902b41dd7be08ac6c34915ba3943d488eb5e9dd3a5c7903
6
+ metadata.gz: 181e4c32e350b14a5e72c3d7df8e8422346d4f95b2b05e1b6ccd7921a2b0314f80467c5d641a902d0366516cea68058fd8a26ae3411ac717c9eb364030473112
7
+ data.tar.gz: 200be1d6c1ad4245b1e1b1c4b36c14e39a3ac52018c5d2f5c6f49bc7cd05353fe1a1835cd8ef5ac918899bf956e0a411e669fd54b2ca39f01613e51872af0269
data/.travis.yml CHANGED
@@ -1,3 +1,10 @@
1
1
  language: ruby
2
+ script: bundle exec rspec
2
3
  rvm:
3
- - 2.2.2
4
+ - 1.9.3
5
+ - 2.0.0
6
+ - 2.1.0
7
+ - ruby-head
8
+ matrix:
9
+ allow_failures:
10
+ - rvm: ruby-head
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, :warning_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 use same validators,
33
- # calling #valid? or #errors will be #no_errors? and #warnings, respectively (on self or record)
34
- validates :warning_name, presence: true
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
- model = BasicModel.new(name: "a")
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.warnings.keys # => [:warning_name]
45
-
46
- model.using_warnings? # => false, is true if warnings are used (within #safe call)
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
  ```
@@ -18,6 +18,5 @@ Gem::Specification.new do |spec|
18
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "activemodel", "~> 4.2"
22
-
21
+ spec.add_dependency "activemodel", '> 4.1.0'
23
22
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveWarnings
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
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.2
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-07-27 00:00:00.000000000 Z
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: '4.2'
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: '4.2'
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.