util-params 0.2.11 → 0.2.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/util/params/params.rb +15 -7
- data/lib/util/params/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 10f2fcbe620b6702655380199db9949d984173e3f1b80297f19c2fa8d5194a04
|
4
|
+
data.tar.gz: c3cba740cd65c588c2c20f801695e553c5da9b6c13efcf28f6d6cd07c10fcd6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fa8adff458905f4ed04bc54cebc154fbf11d6461c0502b1953749451b072f40b9ed3a994b0225000dde390c08c76afb44a444ab008bb92a4e187a061e93116d
|
7
|
+
data.tar.gz: f8650eb9a9ac89351578f378edd021230a8d1157b6228cd8e170f666ca6c4d32cea3096c3dc51441219e8bd7c9a04e02a9fc3f0f782d3f0bcefe624d7154870a
|
data/lib/util/params/params.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
66
|
+
base = {key: key, type: Type::OBJECT, null: true}
|
67
|
+
get_params base.merge(options)
|
60
68
|
end
|
61
69
|
|
62
70
|
|
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.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- unchi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
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
|
81
|
+
rubygems_version: 2.7.6
|
82
82
|
signing_key:
|
83
83
|
specification_version: 4
|
84
84
|
summary: params utility.
|