Module: UrlReader
Defined Under Namespace
Modules: UrlFixer Classes: BaseError, CannotResolveEncodingError, FileCache, ReadError
Constant Summary collapse
- REQUEST_TIMEOUT =
10- REQUEST_OPEN_TIMEOUT =
10
Instance Method Summary collapse
Methods included from UrlFixer
Instance Method Details
#read_url(url, options = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/url_reader.rb', line 13 def read_url(url, = {}) if defined?(Rails) && Rails.env.development? if ENV['READ_URL_CACHE_NOT_USE'] != 'true' ckey = cache_key(url, ) res = cache.read_entry(ckey) res || read_url_core_with_cache_write(url, , ckey) else read_url_core_with_cache_write(url, ) end else read_url_core(url, ) end end |