Class: Rack::ImgSizes

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/img_sizes.rb,
lib/rack/img_sizes/uri.rb,
lib/rack/img_sizes/version.rb

Defined Under Namespace

Classes: URI

Constant Summary collapse

IDENTIFY_COMMAND =
`which identify`.chomp
VERSION =
"0.0.2"

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ ImgSizes

Returns a new instance of ImgSizes.



10
11
12
# File 'lib/rack/img_sizes.rb', line 10

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/img_sizes.rb', line 16

def _call(env)
  @env = env
  @status, @headers, @body = @app.call(env)
  return [@status, @headers, @body] unless html?

  new_response = Rack::Response.new([], @status, @headers)

  @body.each { |part| new_response.write process_part(part) }
  @body.close if @body.respond_to?(:close)

  new_response.finish
end

#call(env) ⇒ Object



14
# File 'lib/rack/img_sizes.rb', line 14

def call(env); dup._call(env); end