util-params 0.2.10 → 0.2.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/util/params/params.rb +9 -4
- data/lib/util/params/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43200b6c83aaf3621ec92c3aa01395be7f878654
|
4
|
+
data.tar.gz: ff179969237ef02da120a5fde00c27d35e88dfeb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d8ae49b10a6b0593fc12244bec5b82a1d8bd9b298a926095189c2873128b79b026cbb542716d316499a74e8fe3863dbb7e4ed3ee7b51119adc9536ec33e154a
|
7
|
+
data.tar.gz: 9bcef0fdde84360439090aa6f0e5abfd2be564bb85b2d1c7c253bb3dace891c5e9b7dd7e86c05438e00aeee103b3751ea61501f5f9f918ea3d192dc6d140ab98
|
data/lib/util/params/params.rb
CHANGED
@@ -24,7 +24,7 @@ module Util
|
|
24
24
|
options = options.deep_symbolize_keys
|
25
25
|
|
26
26
|
key = options[:key]
|
27
|
-
val = _load_val params, key, options[:default], options[:require]
|
27
|
+
val = _load_val params.permit!.to_h, key, options[:default], options[:require]
|
28
28
|
|
29
29
|
return nil if val.nil?
|
30
30
|
|
@@ -126,7 +126,7 @@ module Util
|
|
126
126
|
for e in enum
|
127
127
|
return v if e === v
|
128
128
|
end
|
129
|
-
_push_error "#{key.to_s} ==
|
129
|
+
_push_error "#{key.to_s} == unknown val [#{v.to_s}]"
|
130
130
|
end
|
131
131
|
|
132
132
|
if min && (v < min)
|
@@ -149,7 +149,7 @@ module Util
|
|
149
149
|
enum.each do |e|
|
150
150
|
return v if e === v
|
151
151
|
end
|
152
|
-
_push_error "#{key.to_s} ==
|
152
|
+
_push_error "#{key.to_s} == unknown val [#{v.to_s}]"
|
153
153
|
end
|
154
154
|
|
155
155
|
if min && (v.length < min)
|
@@ -235,10 +235,15 @@ module Util
|
|
235
235
|
def _validate_object key, val, elements
|
236
236
|
return nil if val.nil?
|
237
237
|
|
238
|
+
unless val.kind_of? Hash
|
239
|
+
_push_error "#{key.to_s}.type != Hash"
|
240
|
+
return nil
|
241
|
+
end
|
242
|
+
|
238
243
|
r = {}
|
239
244
|
|
240
245
|
if elements.nil?
|
241
|
-
return val.
|
246
|
+
return val.to_h
|
242
247
|
end
|
243
248
|
|
244
249
|
elements.map do |options|
|
data/lib/util/params/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: util-params
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- unchi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|