Sha256: eaa4e82eb3c6c83e750013ed6dd3a9cc2bd6931f275ed45d657f6e8492c48973
Contents?: true
Size: 487 Bytes
Versions: 2
Compression:
Stored size: 487 Bytes
Contents
# frozen_string_literal: true # This file is part of Alexandria. # # See the file README.md for authorship and licensing information. require "alexandria/net" module Alexandria module ImageFetcher def fetch_image(uri) result = nil if URI.parse(uri).scheme.nil? File.open(uri, "r") do |io| result = io.read end else result = WWWAgent.new.get(uri) end result rescue Errno::ECONNRESET nil end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
alexandria-book-collection-manager-0.7.10 | lib/alexandria/image_fetcher.rb |
alexandria-book-collection-manager-0.7.9 | lib/alexandria/image_fetcher.rb |