simple_validate 2.0.0 → 2.0.1

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
  SHA256:
3
- metadata.gz: 1f7051ee7f5fc5cec9a9f1f7e4859b6145172302ba667b71d11710b7ca34ad1e
4
- data.tar.gz: bfbbc3767ffee4d622411b1fd1673e32710ceeb611d588e7fa34799e23aa092e
3
+ metadata.gz: 215eb056ff7677f32a10c721a53879a52cf3c08f2b8567ba63b86a6aff81d544
4
+ data.tar.gz: 4340fa2cfb67c41853f9e5aa4f2d6d1ff8303916d648916bceb799503461dc59
5
5
  SHA512:
6
- metadata.gz: 8721e31ba42d72dc48e2690284676930b50c6a9ad6765105e36d51a6c9d068ea8804e1bbfe83424a3d0b725b9a39b19a7cd65f0afe14fe8129da0e66d97d44e6
7
- data.tar.gz: 6e0c1805d7e4027ecb6fec0b4d727a99ef02c0fbe33e9c0e54c2f0f92843de516d63dcf095c31c6b3bfc396f4b7f6258285df8522a056cc531e38cce09343b21
6
+ metadata.gz: a0a854c7b4fd9005eb7e86b035aa585c709d25d33c2b784948ab9d824804c0fdffb04b6e29703bd330f69037d8f9043edf168ca6ede3055a91da5a543ff44db7
7
+ data.tar.gz: 67c997ae9cc465d5b54e68b11b5c8438d04cc6b138c981953958c7b8761ba77c472f4a09d9af6a1178ba96271ba2bb8b0bb9cdf81d968b17594f61998a20f68f
data/.rspec_status CHANGED
@@ -1,4 +1,5 @@
1
1
  example_id | status | run_time |
2
2
  ------------------------------------- | ------ | --------------- |
3
- ./spec/simple_validate_spec.rb[1:1:1] | passed | 0.00136 seconds |
4
- ./spec/simple_validate_spec.rb[1:2:1] | passed | 0.00034 seconds |
3
+ ./spec/simple_validate_spec.rb[1:1:1] | passed | 0.00127 seconds |
4
+ ./spec/simple_validate_spec.rb[1:2:1] | passed | 0.0001 seconds |
5
+ ./spec/simple_validate_spec.rb[1:3:1] | passed | 0.00106 seconds |
@@ -20,6 +20,10 @@ module SimpleValidate
20
20
  @messages.fetch(key)
21
21
  end
22
22
 
23
+ def clear!
24
+ @messages = {}
25
+ end
26
+
23
27
  def empty?
24
28
  @messages.empty?
25
29
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SimpleValidate
4
- VERSION = "2.0.0"
4
+ VERSION = "2.0.1"
5
5
  end
@@ -67,6 +67,8 @@ module SimpleValidate
67
67
  end
68
68
 
69
69
  def validate(instance)
70
+ instance.errors.clear!
71
+
70
72
  validations.each do |validation|
71
73
  if validation.condition.call && !validation.valid?(instance)
72
74
  instance.errors.add(validation.attribute, validation.message)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_validate
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Palaniuk