Class: Rango::Middlewares::Encoding
- Inherits:
-
Object
- Object
- Rango::Middlewares::Encoding
- Defined in:
- lib/rango/rack/middlewares/encoding.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, encoding = ::Encoding.default_external) ⇒ Encoding
constructor
A new instance of Encoding.
Constructor Details
#initialize(app, encoding = ::Encoding.default_external) ⇒ Encoding
Returns a new instance of Encoding.
7 8 9 10 |
# File 'lib/rango/rack/middlewares/encoding.rb', line 7 def initialize(app, encoding = ::Encoding.default_external) @app = app @encoding = encoding end |
Instance Method Details
#call(env) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/rango/rack/middlewares/encoding.rb', line 12 def call(env) env.each do |key, value| env[try_force_encoding(key)] = try_force_encoding(value) end return @app.call(env) end |