Class: Docwatch::Watcher
- Inherits:
-
Object
- Object
- Docwatch::Watcher
- Defined in:
- lib/docwatch/watcher.rb
Instance Method Summary collapse
-
#initialize(file_path) ⇒ Watcher
constructor
A new instance of Watcher.
- #mtime ⇒ Object
- #wait ⇒ Object
Constructor Details
#initialize(file_path) ⇒ Watcher
Returns a new instance of Watcher.
3 4 5 |
# File 'lib/docwatch/watcher.rb', line 3 def initialize(file_path) @file_path = file_path end |
Instance Method Details
#mtime ⇒ Object
7 8 9 |
# File 'lib/docwatch/watcher.rb', line 7 def mtime File.mtime(@file_path) end |
#wait ⇒ Object
11 12 13 14 |
# File 'lib/docwatch/watcher.rb', line 11 def wait now = mtime sleep(0.2) while mtime <= now end |