fluent_validation 0.0.5 → 0.0.6

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: b5def6eed9a533a078facea421870a4f8b61641e
4
- data.tar.gz: 944486fa02704cb9866a767f3f13a88f60ae4818
3
+ metadata.gz: ad25282206232493b7ae6c37e9988b020681b19d
4
+ data.tar.gz: f4592018f73922224ad1ba53403f6daddd3b6e50
5
5
  SHA512:
6
- metadata.gz: 508edb43c1cf7de56656dfcf1a0fa1d11b37c01e462f8635c0bfc8386977786661df1f56e294b3831e25af01f39253383399ea793788594d0a5a85f72a123b68
7
- data.tar.gz: bef78ed35ce1ab551e70555b320c23038508fb419955f0e956ffc6236b75c8df0ade3271eb6ff0009d5ebb4d26b87ccc0e4d7ccaae7573e205d098999aa3baca
6
+ metadata.gz: a372fa9e0e88fb535fbb56659b0e8951c0eade8de7ac8c28ece7877a92829524f320fa945e780a456ea35192c52ad8cae7f4f55f7f56007309cdd823ffca095a
7
+ data.tar.gz: c021f410c217983ad3db28ee8e247c2ee91b5a5d8b56f1b31bbf46f1bb2af360327e1a367517e038e53b1005cf68b24bce5e544245771dda29eff4087d3dc5aa
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
- # FluentValidation
1
+ # Fluent Validation in Ruby
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/fluent_validation`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ A lightweight validation gem for Ruby
6
4
 
7
5
  ## Installation
8
6
 
@@ -21,21 +19,42 @@ Or install it yourself as:
21
19
  $ gem install fluent_validation
22
20
 
23
21
  ## Usage
22
+ ```ruby
23
+ class Member
24
+ attr_accessor :name, :email, :type
25
+ end
26
+ ```
24
27
 
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
-
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
-
33
- ## Contributing
34
-
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/fluent_validation. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
-
37
-
38
- ## License
28
+ ```ruby
29
+ require 'fluent_validation/fluent_validator'
30
+ class MemberValidator < FluentValidation::FluentValidator
31
+ def initialize
32
+ super
33
+
34
+ rule_for(&->(member) { member.name })
35
+ .not_nil
36
+ .length(1, 20)
37
+ .with_name('Name')
38
+
39
+ rule_for(&->(member) { member.email })
40
+ .not_nil
41
+ .length(1, 100)
42
+ .email_address
43
+ .with_name('Email Address')
44
+
45
+ rule_for(&->(member) { member.type })
46
+ .not_nil
47
+ .must(&->(type) { type == 'vip'||type == 'platinum' })
48
+ .with_name('Member Type')
49
+ end
50
+ end
51
+ ```
39
52
 
40
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
53
+ ```ruby
54
+ member = Member.new
55
+ member_validator = MemberValidator.new
56
+ validation_result = member_validator.validate(member)
57
+ ```
41
58
 
59
+ ## Thanks
60
+ This Fluent Validation is inspired by [JeremySkinner's FluentValidation](https://github.com/JeremySkinner/FluentValidation)
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
 
12
12
  spec.summary = %q{Write a short summary, because Rubygems requires one.}
13
13
  spec.description = %q{This is an alpha version. Create a class implements from FluentValidator, then use rule_for method to register validators in its construction method.}
14
- spec.homepage = "https://aaronyu.visualstudio.com/_git/fluent_validation"
14
+ spec.homepage = "https://github.com/milkchocolate/fluent_validation"
15
15
  spec.license = "MIT"
16
16
 
17
17
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
@@ -1,3 +1,3 @@
1
1
  module FluentValidation
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
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.5
4
+ version: 0.0.6
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-09 00:00:00.000000000 Z
11
+ date: 2017-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -98,7 +98,7 @@ files:
98
98
  - lib/fluent_validation/validators/regular_expression_validator.rb
99
99
  - lib/fluent_validation/validators/validator.rb
100
100
  - lib/fluent_validation/version.rb
101
- homepage: https://aaronyu.visualstudio.com/_git/fluent_validation
101
+ homepage: https://github.com/milkchocolate/fluent_validation
102
102
  licenses:
103
103
  - MIT
104
104
  metadata: {}