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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0a4f41ec4a14cc2221c8e961313120c053bf3be
4
- data.tar.gz: e4586fd96299aa70da7e647fed1a9df7165abe9f
3
+ metadata.gz: 43200b6c83aaf3621ec92c3aa01395be7f878654
4
+ data.tar.gz: ff179969237ef02da120a5fde00c27d35e88dfeb
5
5
  SHA512:
6
- metadata.gz: e42f5bff56efb9593f8c8e35f94c3f1e048e0021ee3007a3b48630e0b4dfbe61222e4c3bc7acb71fbe0333f9eaccfe3cd4e6c6c42951d62d765a19603bd41d4a
7
- data.tar.gz: 5da4b198f292654ca1bea7c4c4b4cf127348c20d574091eba9a67425b702c4cb473b69e8a379c35546982316c8f444bae32bf27bb372b492b74c95c8411e06b3
6
+ metadata.gz: 1d8ae49b10a6b0593fc12244bec5b82a1d8bd9b298a926095189c2873128b79b026cbb542716d316499a74e8fe3863dbb7e4ed3ee7b51119adc9536ec33e154a
7
+ data.tar.gz: 9bcef0fdde84360439090aa6f0e5abfd2be564bb85b2d1c7c253bb3dace891c5e9b7dd7e86c05438e00aeee103b3751ea61501f5f9f918ea3d192dc6d140ab98
@@ -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} == unknone val [#{v.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} == unknone val [#{v.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.permit!.to_h
246
+ return val.to_h
242
247
  end
243
248
 
244
249
  elements.map do |options|
@@ -1,5 +1,5 @@
1
1
  module Util
2
2
  module Params
3
- VERSION = "0.2.10"
3
+ VERSION = "0.2.11"
4
4
  end
5
5
  end
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.10
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-05-09 00:00:00.000000000 Z
11
+ date: 2017-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler