fluent_validation 0.0.2 → 0.0.3

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: 8f6985781de8de69ae693cff2e3efd3899ce53ce
4
- data.tar.gz: 91b64ec4fa35d962500844133e29c1d84989575a
3
+ metadata.gz: 8e4c71fbfec915c2b341d8507a97403dd0390fe0
4
+ data.tar.gz: 80d10cdc28ed21110da952d3c956ac0b5ba74360
5
5
  SHA512:
6
- metadata.gz: ab9da90b77150d1a8fa606a773f575096660898a7c5d7fa659a03e568d617f925733109255ec75f551b0081d4687477245859efb26beeb5e7fe4e02a7bb88673
7
- data.tar.gz: b4933c8bcaddfe739fd7b40cc861e549f8d63c4f6b8d8ab21d2a795b9ef5f33e0470e5a3681b63a19d0d4af76c094d43f61d7124e5a00c170c85e5583e0fbfe3
6
+ metadata.gz: 7717b19760fb477779c9c3c0bce4f3b32b686a8ea41cabea4aeee0531f7f278dff44c23723a8242e4f3ab1fb5d35f3c460dd0654ab9dd010e31550c9115ad9ff
7
+ data.tar.gz: 66d3e24dbaa64f71bb0ba8c07e03ef65532bcee5c5303689f31e6e52b4eed37acb473c6979b3b7c4614249481ffcaf2948f95999bd01defd7fbada8447f3d82e
@@ -23,7 +23,7 @@ module FluentValidation
23
23
  validator_context = Validators::AttributeValidatorContext.new @attribute_name, value
24
24
  @validators.each do |validator|
25
25
  result = validator.validate validator_context
26
- validation_failures.concat result if result.class != Results::ValidationSuccess
26
+ validation_failures.concat result
27
27
  end
28
28
  end
29
29
  validation_failures
@@ -1,4 +1,5 @@
1
1
  require 'fluent_validation/validators/not_nil_validator'
2
+ require 'fluent_validation/validators/not_empty_validator'
2
3
  require 'fluent_validation/validators/length_validator'
3
4
  require 'fluent_validation/validators/exact_length_validator'
4
5
  require 'fluent_validation/validators/email_validator'
@@ -22,6 +23,12 @@ module FluentValidation
22
23
  self
23
24
  end
24
25
 
26
+ def not_empty
27
+ validator = Validators::NotEmptyValidator.new
28
+ @attribute_rule.add_validator validator
29
+ self
30
+ end
31
+
25
32
  def length(min, max)
26
33
  validator = Validators::LengthValidator.new(min, max)
27
34
  @attribute_rule.add_validator validator
@@ -10,7 +10,7 @@ module FluentValidation
10
10
 
11
11
  def is_valid?(validator_context)
12
12
  if validator_context.attribute_value.nil?
13
- false
13
+ true
14
14
  else
15
15
  validator_context.attribute_value.length >= @min && validator_context.attribute_value.length <= @max
16
16
  end
@@ -1,3 +1,3 @@
1
1
  module FluentValidation
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent_validation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Yu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-05 00:00:00.000000000 Z
11
+ date: 2017-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler