Class: Rack::ContentDispositionHelper
- Inherits:
-
Object
- Object
- Rack::ContentDispositionHelper
- Defined in:
- lib/rack/content_disposition_helper.rb,
lib/rack/content_disposition_helper/railtie.rb,
lib/rack/content_disposition_helper/version.rb,
lib/rack/content_disposition_helper/converter.rb,
lib/rack/content_disposition_helper/user_agent.rb
Defined Under Namespace
Classes: Converter, Railtie, UserAgent
Constant Summary collapse
- VERSION =
'0.2.0'
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ ContentDispositionHelper
constructor
A new instance of ContentDispositionHelper.
Constructor Details
#initialize(app) ⇒ ContentDispositionHelper
Returns a new instance of ContentDispositionHelper.
12 13 14 |
# File 'lib/rack/content_disposition_helper.rb', line 12 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rack/content_disposition_helper.rb', line 16 def call(env) status_code, headers, body = @app.call(env) user_agent = UserAgent.new(env) converter = Converter.new(headers['Content-Disposition']) if converter.length_limit_exceeded? && user_agent.safari? headers = headers.merge('Content-Disposition' => converter.convert) end [status_code, headers, body] end |