r_validator 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.
@@ -0,0 +1,4 @@
1
+ module RValidator
2
+ autoload :StringValidator, "validators/string_validator"
3
+ end
4
+
@@ -0,0 +1,12 @@
1
+ module RValidator
2
+ module StringValidator
3
+ extend self
4
+ def valid_length?(value, min = 1, max = 65535)
5
+ return value.length >= min && value.length <= max
6
+ end
7
+
8
+ def contain_invalid_chars?(value, invalidChars)
9
+ invalidChars.chars.to_a.any? {|c| value.include? c}
10
+ end
11
+ end
12
+ end
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: r_validator
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Shawn
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-20 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Some helps function to do validate. A tutorial exmaple.
15
+ email: shawn.x.z@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/r_validator.rb
21
+ - lib/validators/string_validator.rb
22
+ homepage:
23
+ licenses: []
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 1.8.24
43
+ signing_key:
44
+ specification_version: 3
45
+ summary: Validate helps
46
+ test_files: []
47
+ has_rdoc: