Class: PageGlimpse::ImageParser

Inherits:
Object
  • Object
show all
Defined in:
lib/page_glimpse/image_parser.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(options = {}, &block) ⇒ ImageParser

Returns a new instance of ImageParser.



7
8
# File 'lib/page_glimpse/image_parser.rb', line 7

def initialize(options = {}, &block)
end

Instance Method Details

#parse(response) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/page_glimpse/image_parser.rb', line 10

def parse(response)
  image = Image.new
  image.content_type    = response.headers[:content_type]
  image.filename        = parse_filename(response.headers[:content_disposition])
  image.content_length  = (response.headers[:content_length] || 0).to_i
  image.content         = response.to_s
  image
end