rack-remove-param 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/rack/remove-param.rb +9 -6
  2. metadata +1 -1
@@ -13,7 +13,7 @@ module Rack
13
13
  @request = Rack::Request.new(env)
14
14
 
15
15
  if @request.post?
16
- delete_param(@request.params)
16
+ delete_params(@request.params)
17
17
  env["rack.request.form_hash"] = @request.params
18
18
  env["rack.request.form_vars"] = Rack::Utils.build_query(@request.params)
19
19
  end
@@ -28,12 +28,15 @@ module Rack
28
28
  @params_to_filter = params.is_a?(String) ? Array.new(1, params) : Array.new(params)
29
29
  end
30
30
 
31
- def delete_param(hash, param_to_filter = nil)
32
- to_filter = param_to_filter ? param_to_filter : @params_to_filter
33
- to_filter.each do |param|
34
- hash.delete(param)
35
- hash.each{|k, value| delete_param(value, param) if value.is_a?(Hash) }
31
+ def delete_params(hash)
32
+ @params_to_filter.each do |param|
33
+ delete_param(hash, param)
36
34
  end
37
35
  end
36
+
37
+ def delete_param(hash, param)
38
+ hash.delete(param)
39
+ hash.each{|k, value| delete_param(value, param) if value.is_a?(Hash) }
40
+ end
38
41
  end
39
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-remove-param
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: