Sha256: a5d0152b573b4e4ac1c3bf1aa79276ddbac820c74f511e6b56d1d76a7b934abf
Contents?: true
Size: 884 Bytes
Versions: 1
Compression:
Stored size: 884 Bytes
Contents
module SiteChecker module IO class ContentFromWeb def initialize(visit_references, root) @visit_references = visit_references @root = root end def get(link) begin uri = create_absolute_reference(link.url) if link.local_page? content = open(uri) if !content.meta['content-type'].start_with?('text/html') raise "not a text/html content-type" end elsif link.local_image? open(uri) elsif @visit_references open(uri) end rescue => e raise "(#{e.message.strip})" end content end private def create_absolute_reference(link) if link.start_with?(@root) URI(link) else URI(@root).merge(link) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
site_checker-0.4.0 | lib/site_checker/io/content_from_web.rb |