class Rabbit::Source::File
Public Class Methods
Source
# File lib/rabbit/source/file.rb, line 24 def self.initial_args_description N_("[FILENAME]") end
Source
# File lib/rabbit/source/file.rb, line 28 def initialize(encoding, logger, name) @name = name super(encoding, logger) @mtime = nil end
Calls superclass method
Rabbit::Source::Base::new
Public Instance Methods
Source
# File lib/rabbit/source/file.rb, line 34 def _read begin check_file ::File.open(@name, "rb") do |f| @mtime = f.mtime f.read end rescue SourceUnreadableError @logger.error($!.message) @mtime = Time.now + LimitAccessInterval::MINIMUM_ACCESS_TIME +"" end end
Source
# File lib/rabbit/source/file.rb, line 52 def extension extract_extension(@name) end
Source
# File lib/rabbit/source/file.rb, line 48 def need_read? super or old?(@mtime, :mtime) end
Calls superclass method
Rabbit::Source::Base#need_read?
Private Instance Methods
Source
# File lib/rabbit/source/file.rb, line 57 def check_file unless ::File.exist?(@name) raise NotExistError.new(@name) end unless ::File.file?(@name) raise NotFileError.new(@name) end unless ::File.readable?(@name) raise NotReadableError.new(@name) end end
Source
# File lib/rabbit/source/file.rb, line 78 def init_base set_base(::File.dirname(@name)) end
Source
# File lib/rabbit/source/file.rb, line 69 def mtime begin check_file ::File.mtime(@name) rescue SourceUnreadableError Time.now end end