Class: Klue::Langcraft::DSL::Watcher

Inherits:
Object
  • Object
show all
Defined in:
lib/klue/langcraft/dsl/watcher.rb

Overview

Watcher class for monitoring file changes in specified directories. This class sets up a file system listener to watch for changes to files with specified extensions, and processes those files using a KlueRunner.

Instance Method Summary collapse

Constructor Details

#initialize(directories, **options) ⇒ Watcher

Returns a new instance of Watcher.



12
13
14
15
16
17
# File 'lib/klue/langcraft/dsl/watcher.rb', line 12

def initialize(directories, **options)
  @directories = directories.map { |dir| File.expand_path(dir) }
  @options = options
  @klue_runner = Klue::Langcraft::DSL::KlueRunner.new
  @extensions = options[:extensions] || ['.klue']
end

Instance Method Details

#startObject



19
20
21
22
23
24
# File 'lib/klue/langcraft/dsl/watcher.rb', line 19

def start
  listener = create_listener
  log_watcher_info
  listener.start
  sleep
end