rails_param 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rails_param/param_evaluator.rb +4 -3
- data/lib/rails_param/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e99b0ab6dac912811e4d43f26b9fae9d14363bbdf619fc72fc79f9b9eb9caf31
|
4
|
+
data.tar.gz: 0bce166f4e27fb282758307f6aa76a03959977ecc41c22a497fc6e02f663f9a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2d475689feed854e28bc075527c5b8528de9f5215ae5e13ff95b0a7a740106e61c04da3f44be9ffa8a40d082f93cb2d6fb145fe5ee37694a14bf0a14181d4d0
|
7
|
+
data.tar.gz: cbda11bbce71ec5daeefc3fe9d2ba78ec3b3a652296efc57ac7cf8a5038ac45f9e8a99c4a7a4b1d5ce3f0a697136be177f1666095af1b4fafd3e501ee6486ff8
|
@@ -10,9 +10,7 @@ module RailsParam
|
|
10
10
|
name = name.is_a?(Integer)? name : name.to_s
|
11
11
|
return unless params.include?(name) || check_param_presence?(options[:default]) || options[:required]
|
12
12
|
|
13
|
-
|
14
|
-
coerced_value = params.include?(name) ?
|
15
|
-
coerce(params[name], type, options) : nil
|
13
|
+
coerced_value = coerce(params[name], type, options)
|
16
14
|
|
17
15
|
parameter = RailsParam::Parameter.new(
|
18
16
|
name: name,
|
@@ -48,6 +46,8 @@ module RailsParam
|
|
48
46
|
private
|
49
47
|
|
50
48
|
def recurse_on_parameter(parameter, &block)
|
49
|
+
return if parameter.value.nil?
|
50
|
+
|
51
51
|
if parameter.type == Array
|
52
52
|
parameter.value.each_with_index do |element, i|
|
53
53
|
if element.is_a?(Hash) || element.is_a?(ActionController::Parameters)
|
@@ -73,6 +73,7 @@ module RailsParam
|
|
73
73
|
|
74
74
|
def coerce(param, type, options = {})
|
75
75
|
begin
|
76
|
+
return nil if param.nil?
|
76
77
|
return param if (param.is_a?(type) rescue false)
|
77
78
|
|
78
79
|
Coercion.new(param, type, options).coerce
|
data/lib/rails_param/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_param
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicolas Blanco
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|