rails_param 1.3.0 → 1.3.1

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
  SHA256:
3
- metadata.gz: f7548ff9d3a5851e52153ea5ad00840da23b245a5f03605d1bdd15e4f252f229
4
- data.tar.gz: 0dfb6578fbf82389851427104d7489ee9341afc614e2556bb93f00951a9222ad
3
+ metadata.gz: b32fa09a116632065ef4726382ba7f10a83c9cdcb56f8b15c75fcd9fc2577667
4
+ data.tar.gz: 97b1d1485ba6abec6e87eee788bd3899702f5b0af565f6b159606107276c210f
5
5
  SHA512:
6
- metadata.gz: 169efbc2ce24496da87055af5708d4ca70adb0855ae2a8a3f57bd7138809073a51ce2af68d7d77562447f07ced60eb4aab2dc671678290eaa6a885d1c7d08cc0
7
- data.tar.gz: f472e6a6b81699ccd7ecd10c69a91de5451e2f9ab4e94d93060faebcffbe8472ee34aa02aa7c290ed014c1d4afbb3b842b8904985d93ecfadba6f31cba6bb3b2
6
+ metadata.gz: ae6601c59348ef2f899aca2e5d54613882028134fd7fbe0757bd0bee507b873eadf7d2e488b3010c401faea06ba9fdee23992274416a70f6711f824aef9d6f65
7
+ data.tar.gz: 4602f52aae2d9f625f8464cbaa2de07baf658e7112e9185fcb9e917787c97d6095dad62cbf4483faedb77dc281d6b5af2a621a90993c7e0033cdc9d6b101f5d9
@@ -12,7 +12,7 @@ module RailsParam
12
12
  return unless params.include?(name) || check_param_presence?(options[:default]) || options[:required]
13
13
 
14
14
  parameter_name = @context ? "#{@context}[#{name}]" : name
15
- coerced_value = coerce(params[name], type, options)
15
+ coerced_value = coerce(parameter_name, params[name], type, options)
16
16
 
17
17
  parameter = RailsParam::Parameter.new(
18
18
  name: parameter_name,
@@ -36,7 +36,7 @@ module RailsParam
36
36
  recurse_on_parameter(parameter, &block) if block_given?
37
37
 
38
38
  # apply transformation
39
- parameter.transform if params.include?(name) && options[:transform]
39
+ parameter.transform if options[:transform]
40
40
 
41
41
  # validate
42
42
  validate!(parameter)
@@ -73,14 +73,14 @@ module RailsParam
73
73
  !param.nil?
74
74
  end
75
75
 
76
- def coerce(param, type, options = {})
76
+ def coerce(param_name, param, type, options = {})
77
77
  begin
78
78
  return nil if param.nil?
79
79
  return param if (param.is_a?(type) rescue false)
80
80
 
81
81
  Coercion.new(param, type, options).coerce
82
82
  rescue ArgumentError, TypeError
83
- raise InvalidParameterError, "'#{param}' is not a valid #{type}"
83
+ raise InvalidParameterError.new("'#{param}' is not a valid #{type}", param: param_name)
84
84
  end
85
85
  end
86
86
 
@@ -1,3 +1,3 @@
1
1
  module RailsParam #:nodoc
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.1"
3
3
  end
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.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Blanco
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-21 00:00:00.000000000 Z
11
+ date: 2023-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec