Class: Rack::Sanitize

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/sanitize.rb,
lib/rack-sanitize/version.rb

Constant Summary collapse

VERSION =
"0.1.0"

Instance Method Summary collapse

Constructor Details

#initialize(app, config = {}) ⇒ Sanitize

Returns a new instance of Sanitize.



5
6
7
8
# File 'lib/rack/sanitize.rb', line 5

def initialize(app, config={})
  @app    = app
  @config = config
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
# File 'lib/rack/sanitize.rb', line 10

def call(env)
  request = Rack::Request.new(env)
  request.GET.each {|k,v| request.GET[k] = sanitize(v)}
  request.POST.each {|k,v| request.POST[k] = sanitize(v)}
  @app.call(env)
end