Class: RackUndefined
- Inherits:
-
Struct
- Object
- Struct
- RackUndefined
- Defined in:
- lib/rack-undefined.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
Returns the value of attribute app.
Instance Method Summary collapse
Instance Attribute Details
#app ⇒ Object
Returns the value of attribute app
2 3 4 |
# File 'lib/rack-undefined.rb', line 2 def app @app end |
Instance Method Details
#call(env) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/rack-undefined.rb', line 5 def call(env) request = Rack::Request.new(env) request.params.each do |key, value| request.update_param key, undefine(value) end app.call(env) end |
#undefine(obj) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rack-undefined.rb', line 13 def undefine(obj) case obj when "null", "undefined" nil when Array obj.map(&undefine) when Hash Hash[obj.map(&undefine)] else obj end end |