wrangler 0.1.17 → 0.1.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/wrangler.rb +58 -58
  2. data/wrangler.gemspec +2 -2
  3. metadata +2 -2
data/lib/wrangler.rb CHANGED
@@ -86,64 +86,6 @@ module Wrangler
86
86
  end
87
87
 
88
88
 
89
- # extract a hash of relevant (and serializable) parameters from a request
90
- # NOTE: will obey +filter_paramters+ on any class including the module,
91
- # avoid logging any data in the request that the app wouldn't log itself.
92
- # +filter_paramters+ must follow the rails convention of returning
93
- # the association but with the value obscured in some way
94
- # (e.g. "[FILTERED]"). see +filter_paramter_logging+ .
95
- #---------------------------------------------------------------------------
96
- def request_data_from_request(request)
97
- return nil if request.nil?
98
-
99
- request_data = {}
100
- request.env.each_pair do |k,v|
101
- next if skip_request_env?(k)
102
-
103
- if self.respond_to?(:filter_parameters)
104
- request_data.merge! self.send(:filter_parameters, k => v)
105
- else
106
- request_data.merge! k => v
107
- end
108
- end
109
-
110
- params = {}
111
- if self.respond_to?(:filter_parameters)
112
- params.merge!(
113
- filter_parameters(request.env['action_controller.request.query_parameters'])
114
- )
115
- params.merge!(
116
- filter_parameters(request.env['action_controller.request.request_parameters'])
117
- )
118
- else
119
- params.merge! request.env['action_controller.request.query_parameters']
120
- params.merge! request.env['action_controller.request.request_parameters']
121
- end
122
-
123
- request_data.merge! :params => params unless params.blank?
124
-
125
- return request_data
126
- end
127
-
128
-
129
- # determine if the request env param should be ommitted from the request
130
- # data object, as specified in config (either for aesthetic reasons or
131
- # because the param won't serialize well).
132
- #---------------------------------------------------------------------------
133
- def skip_request_env?(request_param)
134
- skip_env = false
135
- Wrangler::ExceptionHandler.config[:request_env_to_skip].each do |pattern|
136
- if (pattern.is_a?(String) && pattern == request_param) ||
137
- (pattern.is_a?(Regexp) && pattern =~ request_param)
138
- skip_env = true
139
- break
140
- end
141
- end
142
-
143
- return skip_env
144
- end
145
-
146
-
147
89
  # select the proper file to render and do so. if the usual places don't
148
90
  # turn up an appropriate template (see README), then fall back on
149
91
  # an app-specific default error page or the ultimate back up gem default
@@ -287,4 +229,62 @@ module Wrangler
287
229
 
288
230
  end # end ControllerMethods module
289
231
 
232
+
233
+ # extract a hash of relevant (and serializable) parameters from a request
234
+ # NOTE: will obey +filter_paramters+ on any class including the module,
235
+ # avoid logging any data in the request that the app wouldn't log itself.
236
+ # +filter_paramters+ must follow the rails convention of returning
237
+ # the association but with the value obscured in some way
238
+ # (e.g. "[FILTERED]"). see +filter_paramter_logging+ .
239
+ #-----------------------------------------------------------------------------
240
+ def request_data_from_request(request)
241
+ return nil if request.nil?
242
+
243
+ request_data = {}
244
+ request.env.each_pair do |k,v|
245
+ next if skip_request_env?(k)
246
+
247
+ if self.respond_to?(:filter_parameters)
248
+ request_data.merge! self.send(:filter_parameters, k => v)
249
+ else
250
+ request_data.merge! k => v
251
+ end
252
+ end
253
+
254
+ request_params = {}
255
+ if self.respond_to?(:filter_parameters)
256
+ request_params.merge!(
257
+ filter_parameters(request.env['action_controller.request.query_parameters'])
258
+ )
259
+ request_params.merge!(
260
+ filter_parameters(request.env['action_controller.request.request_parameters'])
261
+ )
262
+ else
263
+ request_params.merge! request.env['action_controller.request.query_parameters']
264
+ request_params.merge! request.env['action_controller.request.request_parameters']
265
+ end
266
+
267
+ request_data.merge! :params => request_params unless request_params.blank?
268
+
269
+ return request_data
270
+ end
271
+
272
+
273
+ # determine if the request env param should be ommitted from the request
274
+ # data object, as specified in config (either for aesthetic reasons or
275
+ # because the param won't serialize well).
276
+ #---------------------------------------------------------------------------
277
+ def skip_request_env?(request_param)
278
+ skip_env = false
279
+ Wrangler::ExceptionHandler.config[:request_env_to_skip].each do |pattern|
280
+ if (pattern.is_a?(String) && pattern == request_param) ||
281
+ (pattern.is_a?(Regexp) && pattern =~ request_param)
282
+ skip_env = true
283
+ break
284
+ end
285
+ end
286
+
287
+ return skip_env
288
+ end
289
+
290
290
  end # end Wrangler module
data/wrangler.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{wrangler}
8
- s.version = "0.1.17"
8
+ s.version = "0.1.18"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Brian Percival"]
12
- s.date = %q{2010-04-02}
12
+ s.date = %q{2010-04-09}
13
13
  s.description = %q{A gem for handling exceptions thrown inside your Rails app. If you include the
14
14
  gem in your application controller, wrangler will render the error pages you
15
15
  configure for each exception or HTTP error code. It will also handle notifying
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wrangler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.17
4
+ version: 0.1.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Percival
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-04-02 00:00:00 -07:00
12
+ date: 2010-04-09 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency