util-params 0.2.11 → 0.2.13

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
- SHA1:
3
- metadata.gz: 43200b6c83aaf3621ec92c3aa01395be7f878654
4
- data.tar.gz: ff179969237ef02da120a5fde00c27d35e88dfeb
2
+ SHA256:
3
+ metadata.gz: 10f2fcbe620b6702655380199db9949d984173e3f1b80297f19c2fa8d5194a04
4
+ data.tar.gz: c3cba740cd65c588c2c20f801695e553c5da9b6c13efcf28f6d6cd07c10fcd6b
5
5
  SHA512:
6
- metadata.gz: 1d8ae49b10a6b0593fc12244bec5b82a1d8bd9b298a926095189c2873128b79b026cbb542716d316499a74e8fe3863dbb7e4ed3ee7b51119adc9536ec33e154a
7
- data.tar.gz: 9bcef0fdde84360439090aa6f0e5abfd2be564bb85b2d1c7c253bb3dace891c5e9b7dd7e86c05438e00aeee103b3751ea61501f5f9f918ea3d192dc6d140ab98
6
+ metadata.gz: 5fa8adff458905f4ed04bc54cebc154fbf11d6461c0502b1953749451b072f40b9ed3a994b0225000dde390c08c76afb44a444ab008bb92a4e187a061e93116d
7
+ data.tar.gz: f8650eb9a9ac89351578f378edd021230a8d1157b6228cd8e170f666ca6c4d32cea3096c3dc51441219e8bd7c9a04e02a9fc3f0f782d3f0bcefe624d7154870a
@@ -26,37 +26,45 @@ module Util
26
26
  key = options[:key]
27
27
  val = _load_val params.permit!.to_h, key, options[:default], options[:require]
28
28
 
29
+ _push_error "*[#{key.to_s}] == nil" unless options[:null]
29
30
  return nil if val.nil?
30
31
 
31
32
  _validate key, options[:type], val, options
32
33
  end
33
34
 
34
35
  def get_int_params key, options={}
35
- get_params options.merge(key: key, type: Type::INTEGER)
36
+ base = {key: key, type: Type::INTEGER, null: true}
37
+ get_params base.merge(options)
36
38
  end
37
39
 
38
40
  def get_str_params key, options={}
39
- get_params options.merge(key: key, type: Type::STRING)
41
+ base = {key: key, type: Type::STRING, null: true}
42
+ get_params base.merge(options)
40
43
  end
41
44
 
42
45
  def get_float_params key, options={}
43
- get_params options.merge(key: key, type: Type::FLOAT)
46
+ base = {key: key, type: Type::FLOAT, null: true}
47
+ get_params base.merge(options)
44
48
  end
45
49
 
46
50
  def get_file_params key, options={}
47
- get_params options.merge(key: key, type: Type::FILE)
51
+ base = {key: key, type: Type::FILE, null: true}
52
+ get_params base.merge(options)
48
53
  end
49
54
 
50
55
  def get_bool_params key, options={}
51
- get_params options.merge(key: key, type: Type::BOOLEAN)
56
+ base = {key: key, type: Type::BOOLEAN, null: true}
57
+ get_params base.merge(options)
52
58
  end
53
59
 
54
60
  def get_array_params key, options={}
55
- get_params options.merge(key: key, type: Type::ARRAY)
61
+ base = {key: key, type: Type::ARRAY, null: true}
62
+ get_params base.merge(options)
56
63
  end
57
64
 
58
65
  def get_object_params key, options={}
59
- get_params options.merge(key: key, type: Type::OBJECT)
66
+ base = {key: key, type: Type::OBJECT, null: true}
67
+ get_params base.merge(options)
60
68
  end
61
69
 
62
70
 
@@ -1,5 +1,5 @@
1
1
  module Util
2
2
  module Params
3
- VERSION = "0.2.11"
3
+ VERSION = "0.2.13"
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.11
4
+ version: 0.2.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - unchi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-20 00:00:00.000000000 Z
11
+ date: 2018-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  version: '0'
79
79
  requirements: []
80
80
  rubyforge_project:
81
- rubygems_version: 2.6.11
81
+ rubygems_version: 2.7.6
82
82
  signing_key:
83
83
  specification_version: 4
84
84
  summary: params utility.