class Rabbit::Source::URI
Public Class Methods
new(encoding, logger, uri)
click to toggle source
Calls superclass method
Rabbit::Source::LimitAccessInterval.new
# File lib/rabbit/source/uri.rb, line 29 def initialize(encoding, logger, uri) @uri = ::URI.parse(uri) super(encoding, logger) @last_modified = nil end
Public Instance Methods
extension()
click to toggle source
# File lib/rabbit/source/uri.rb, line 39 def extension extract_extension(@uri.path) end
initial_args_description()
click to toggle source
# File lib/rabbit/source/uri.rb, line 24 def initial_args_description N_("URI") end
need_read?()
click to toggle source
Calls superclass method
Rabbit::Source::Base#need_read?
# File lib/rabbit/source/uri.rb, line 35 def need_read? super or old?(@last_modified, :last_modified) end
new(encoding, logger, uri)
click to toggle source
Calls superclass method
Rabbit::Source::LimitAccessInterval.new
# File lib/rabbit/source/uri.rb, line 14 def new(encoding, logger, uri) parsed_uri = ::URI.parse(uri) case parsed_uri.scheme when nil, /file/i File.new(encoding, logger, parsed_uri.path) else super end end
Private Instance Methods
_read()
click to toggle source
# File lib/rabbit/source/uri.rb, line 44 def _read begin @uri.open do |f| @last_modified = f.last_modified f.read end rescue @logger.error($!.message) @last_modified = Time.now + MINIMUM_ACCESS_TIME "" end end
init_base()
click to toggle source
# File lib/rabbit/source/uri.rb, line 57 def init_base base = @uri.dup base.path = ::File.dirname(base.path) set_base(base.to_s) end
last_modified()
click to toggle source
# File lib/rabbit/source/uri.rb, line 63 def last_modified begin @uri.open do |f| f.last_modified end rescue @logger.error($!.message) Time.now end end