Class: Harnex::FileChangeHook
- Inherits:
-
Object
- Object
- Harnex::FileChangeHook
- Defined in:
- lib/harnex/runtime/file_change_hook.rb
Constant Summary collapse
- EVENT_HEADER_SIZE =
16- WATCH_MASK =
Inotify::IN_ATTRIB | Inotify::IN_CLOSE_WRITE | Inotify::IN_CREATE | Inotify::IN_MOVED_TO
- RETRY_SECONDS =
1.0- IDLE_SLEEP_SECONDS =
0.1
Instance Method Summary collapse
-
#initialize(session, config) ⇒ FileChangeHook
constructor
A new instance of FileChangeHook.
- #start ⇒ Object
Constructor Details
#initialize(session, config) ⇒ FileChangeHook
Returns a new instance of FileChangeHook.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/harnex/runtime/file_change_hook.rb', line 8 def initialize(session, config) @session = session @config = config @target_dir = File.dirname(config.absolute_path) @target_name = File.basename(config.absolute_path) @buffer = +"" @buffer.force_encoding(Encoding::BINARY) @mutex = Mutex.new @change_generation = 0 @delivered_generation = 0 @last_change_at = nil end |
Instance Method Details
#start ⇒ Object
21 22 23 |
# File 'lib/harnex/runtime/file_change_hook.rb', line 21 def start Thread.new { run } end |