Class: Rabbit::Source::File
- Inherits:
-
Object
- Object
- Rabbit::Source::File
- Includes:
- Base
- Defined in:
- lib/rabbit/source/file.rb
Instance Attribute Summary
Attributes included from Base
#base, #encoding, #force_modified, #tmp_base
Class Method Summary collapse
Instance Method Summary collapse
- #_read ⇒ Object
-
#initialize(encoding, logger, name) ⇒ File
constructor
A new instance of File.
- #need_read? ⇒ Boolean
Methods included from Base
append_features, #full_path, #modified?, #old?, #open_full_path, #read, #reset, #source=, #tmp_dir_name
Constructor Details
#initialize(encoding, logger, name) ⇒ File
Returns a new instance of File.
12 13 14 15 16 |
# File 'lib/rabbit/source/file.rb', line 12 def initialize(encoding, logger, name) @name = name super(encoding, logger) @mtime = nil end |
Class Method Details
.initial_args_description ⇒ Object
8 9 10 |
# File 'lib/rabbit/source/file.rb', line 8 def self.initial_args_description N_("[FILENAME]") end |
Instance Method Details
#_read ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rabbit/source/file.rb', line 18 def _read begin check_file ::File.open(@name) do |f| @mtime = f.mtime f.read end rescue SourceUnreadableError @logger.error($!.) @mtime = Time.now + LimitAccessInterval::MINIMUM_ACCESS_TIME "" end end |
#need_read? ⇒ Boolean
32 33 34 |
# File 'lib/rabbit/source/file.rb', line 32 def need_read? super or old?(@mtime, :mtime) end |