Class: Docwatch::Watcher

Inherits:
Object
  • Object
show all
Defined in:
lib/docwatch/watcher.rb

Instance Method Summary collapse

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

#mtimeObject



7
8
9
# File 'lib/docwatch/watcher.rb', line 7

def mtime
    File.mtime(@file_path)
end

#waitObject



11
12
13
14
# File 'lib/docwatch/watcher.rb', line 11

def wait
    now = mtime
    sleep(0.2) while mtime <= now
end