Sha256: c504ba32f693cac2a627d144fff4c2e684920ed202a9be742f5a080ae5d4f075
Contents?: true
Size: 636 Bytes
Versions: 8
Compression:
Stored size: 636 Bytes
Contents
require 'page_glimpse/image' module PageGlimpse class ImageParser #:nodoc: def initialize(options = {}, &block) end 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 private def parse_filename(disposition) if disposition =~ /filename="([^"]*)"/i $1 end end end end
Version data entries
8 entries across 8 versions & 2 rubygems