Class: Rack::GoogleImage
- Inherits:
-
Object
- Object
- Rack::GoogleImage
- Defined in:
- lib/rack-middleware-google-image.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ GoogleImage
constructor
A new instance of GoogleImage.
Constructor Details
#initialize(app, options = {}) ⇒ GoogleImage
Returns a new instance of GoogleImage.
8 9 10 |
# File 'lib/rack-middleware-google-image.rb', line 8 def initialize(app, = {}) @app = app end |
Instance Method Details
#call(env) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rack-middleware-google-image.rb', line 12 def call(env) status, headers, response = @app.call(env) if env['PATH_INFO'] =~ (/\/(.*)\.jpg$/) response = search_image(response, Rack::Utils::unescape($1)) [status, headers, response] end [status, headers, response] end |