Class: Rack::Glitch
- Inherits:
-
Object
- Object
- Rack::Glitch
- Defined in:
- lib/rack-middleware-glitch.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Glitch
constructor
A new instance of Glitch.
Constructor Details
#initialize(app, options = {}) ⇒ Glitch
Returns a new instance of Glitch.
3 4 5 |
# File 'lib/rack-middleware-glitch.rb', line 3 def initialize(app, = {}) @app = app end |
Instance Method Details
#call(env) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/rack-middleware-glitch.rb', line 7 def call(env) status, headers, response = @app.call(env) if headers['content-type'] =~ /jpeg/ response = glitch(response) end [status, headers, response] end |