Class: Klue::Langcraft::DSL::Watcher
- Inherits:
-
Object
- Object
- Klue::Langcraft::DSL::Watcher
- 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
-
#initialize(directories, **options) ⇒ Watcher
constructor
A new instance of Watcher.
- #start ⇒ Object
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, **) @directories = directories.map { |dir| File.(dir) } @options = @klue_runner = Klue::Langcraft::DSL::KlueRunner.new @extensions = [:extensions] || ['.klue'] end |
Instance Method Details
#start ⇒ Object
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 |