data-validator 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/data-validator.gemspec +3 -3
- data/lib/data/validator.rb +2 -2
- data/lib/data/validator/version.rb +1 -1
- data/test/gfx/003_default.rb +1 -1
- metadata +43 -24
- checksums.yaml +0 -7
data/data-validator.gemspec
CHANGED
@@ -22,7 +22,7 @@
|
|
22
22
|
# SOFTWARE.
|
23
23
|
|
24
24
|
# hack avoid namespace pollution
|
25
|
-
path = File.expand_path 'lib/data/validator/version.rb',
|
25
|
+
path = File.expand_path 'lib/data/validator/version.rb', File.dirname(__FILE__)
|
26
26
|
content = File.read path
|
27
27
|
version = Module.new.module_eval <<-'end'
|
28
28
|
Data = Module.new
|
@@ -45,8 +45,8 @@ Gem::Specification.new do |spec|
|
|
45
45
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
46
46
|
spec.require_paths = ["lib"]
|
47
47
|
|
48
|
-
|
49
|
-
spec.add_development_dependency 'bundler', '~> 1.
|
48
|
+
spec.required_ruby_version = '>= 1.9.3'
|
49
|
+
spec.add_development_dependency 'bundler', '~> 1.5'
|
50
50
|
spec.add_development_dependency 'rake', '~> 10.3'
|
51
51
|
spec.add_development_dependency 'rdoc', '~> 4.0'
|
52
52
|
spec.add_development_dependency 'yard', '~> 0.8'
|
data/lib/data/validator.rb
CHANGED
@@ -75,7 +75,7 @@ class Data::Validator
|
|
75
75
|
# @option rule [true,false] :option Omitable or not.
|
76
76
|
# @option rule [true,false] :allow_extra Can have others or not.
|
77
77
|
# @option rule [Hash] :rule Recursion rule.
|
78
|
-
def initialize(
|
78
|
+
def initialize(rule = {})
|
79
79
|
@isa = rule.delete(:isa) || Object # ??
|
80
80
|
@rule = rule
|
81
81
|
if rule.has_key? :rule then
|
@@ -85,7 +85,7 @@ class Data::Validator
|
|
85
85
|
when @isa == Hash then
|
86
86
|
recur = rule[:rule].each_pair.each_with_object Hash.new do |(k, v), r|
|
87
87
|
case v when Hash then
|
88
|
-
r[k] = self.class.send :bare_new,
|
88
|
+
r[k] = self.class.send :bare_new, v
|
89
89
|
else
|
90
90
|
r[k] = self.class.send :bare_new, isa: v
|
91
91
|
end
|
data/test/gfx/003_default.rb
CHANGED
@@ -20,7 +20,7 @@ class Test003Default < Test::Unit::TestCase
|
|
20
20
|
|
21
21
|
v = Data::Validator.new(
|
22
22
|
'foo' => { isa: Numeric, default: 99 },
|
23
|
-
'bar' => { isa: Numeric, default:
|
23
|
+
'bar' => { isa: Numeric, default: lambda {|validator, rule, args|
|
24
24
|
args['foo'] + 1
|
25
25
|
} },
|
26
26
|
)
|
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data-validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Urabe, Shyouhei
|
@@ -13,99 +14,113 @@ dependencies:
|
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
|
-
- -
|
19
|
+
- - ~>
|
18
20
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
21
|
+
version: '1.5'
|
20
22
|
type: :development
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
|
-
- -
|
27
|
+
- - ~>
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
29
|
+
version: '1.5'
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: rake
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
|
-
- -
|
35
|
+
- - ~>
|
32
36
|
- !ruby/object:Gem::Version
|
33
37
|
version: '10.3'
|
34
38
|
type: :development
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
|
-
- -
|
43
|
+
- - ~>
|
39
44
|
- !ruby/object:Gem::Version
|
40
45
|
version: '10.3'
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: rdoc
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
|
-
- -
|
51
|
+
- - ~>
|
46
52
|
- !ruby/object:Gem::Version
|
47
53
|
version: '4.0'
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
|
-
- -
|
59
|
+
- - ~>
|
53
60
|
- !ruby/object:Gem::Version
|
54
61
|
version: '4.0'
|
55
62
|
- !ruby/object:Gem::Dependency
|
56
63
|
name: yard
|
57
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
58
66
|
requirements:
|
59
|
-
- -
|
67
|
+
- - ~>
|
60
68
|
- !ruby/object:Gem::Version
|
61
69
|
version: '0.8'
|
62
70
|
type: :development
|
63
71
|
prerelease: false
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
65
74
|
requirements:
|
66
|
-
- -
|
75
|
+
- - ~>
|
67
76
|
- !ruby/object:Gem::Version
|
68
77
|
version: '0.8'
|
69
78
|
- !ruby/object:Gem::Dependency
|
70
79
|
name: test-unit
|
71
80
|
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
72
82
|
requirements:
|
73
|
-
- -
|
83
|
+
- - ~>
|
74
84
|
- !ruby/object:Gem::Version
|
75
85
|
version: '3.0'
|
76
86
|
type: :development
|
77
87
|
prerelease: false
|
78
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
79
90
|
requirements:
|
80
|
-
- -
|
91
|
+
- - ~>
|
81
92
|
- !ruby/object:Gem::Version
|
82
93
|
version: '3.0'
|
83
94
|
- !ruby/object:Gem::Dependency
|
84
95
|
name: simplecov
|
85
96
|
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
86
98
|
requirements:
|
87
|
-
- -
|
99
|
+
- - ! '>='
|
88
100
|
- !ruby/object:Gem::Version
|
89
101
|
version: '0'
|
90
102
|
type: :development
|
91
103
|
prerelease: false
|
92
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
93
106
|
requirements:
|
94
|
-
- -
|
107
|
+
- - ! '>='
|
95
108
|
- !ruby/object:Gem::Version
|
96
109
|
version: '0'
|
97
110
|
- !ruby/object:Gem::Dependency
|
98
111
|
name: pry
|
99
112
|
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
100
114
|
requirements:
|
101
|
-
- -
|
115
|
+
- - ~>
|
102
116
|
- !ruby/object:Gem::Version
|
103
117
|
version: '0.10'
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
107
122
|
requirements:
|
108
|
-
- -
|
123
|
+
- - ~>
|
109
124
|
- !ruby/object:Gem::Version
|
110
125
|
version: '0.10'
|
111
126
|
description: for gfx fan and xaicron fan
|
@@ -115,7 +130,7 @@ executables: []
|
|
115
130
|
extensions: []
|
116
131
|
extra_rdoc_files: []
|
117
132
|
files:
|
118
|
-
-
|
133
|
+
- .gitignore
|
119
134
|
- Gemfile
|
120
135
|
- LICENSE.txt
|
121
136
|
- README.md
|
@@ -140,26 +155,30 @@ files:
|
|
140
155
|
homepage: https://metacpan.org/pod/Data::Validator
|
141
156
|
licenses:
|
142
157
|
- MIT
|
143
|
-
metadata: {}
|
144
158
|
post_install_message:
|
145
159
|
rdoc_options: []
|
146
160
|
require_paths:
|
147
161
|
- lib
|
148
162
|
required_ruby_version: !ruby/object:Gem::Requirement
|
163
|
+
none: false
|
149
164
|
requirements:
|
150
|
-
- -
|
165
|
+
- - ! '>='
|
151
166
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
167
|
+
version: 1.9.3
|
153
168
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
154
170
|
requirements:
|
155
|
-
- -
|
171
|
+
- - ! '>='
|
156
172
|
- !ruby/object:Gem::Version
|
157
173
|
version: '0'
|
174
|
+
segments:
|
175
|
+
- 0
|
176
|
+
hash: -1503191455566766028
|
158
177
|
requirements: []
|
159
178
|
rubyforge_project:
|
160
|
-
rubygems_version:
|
179
|
+
rubygems_version: 1.8.23.2
|
161
180
|
signing_key:
|
162
|
-
specification_version:
|
181
|
+
specification_version: 3
|
163
182
|
summary: p5-Data-Validator / p5-Data-Validator-Recursive port
|
164
183
|
test_files:
|
165
184
|
- test/gfx/000_load.rb
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 6c0b111d5ff665740d694bc24cc0b880764592b3
|
4
|
-
data.tar.gz: 37224d4295b3f968e58b52874656b465e75dbf81
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 040be98b8146b289a6cf59f490e0d6bd949f02c2f6a9fe439a849d728f1a08590d26f795cf94ea54990973f9b098f03cfe9694a743edb5ffb59975d4f4eb284b
|
7
|
-
data.tar.gz: e7fb62c23cef4b75597befdbb5895e8e285e2ef130a21b0866a5d755be6bf78779fe49df876b948248ebc68e6178cd000d4df3582900a943ea47cae7b7d02548
|