class Maid::Watch

Attributes

listener[R]
logger[R]
path[R]

Public Class Methods

new(maid, path, options = {}, &rules) click to toggle source
# File lib/maid/watch.rb, line 7
def initialize(maid, path, options = {}, &rules)
  @maid = maid
  @options = options
  @logger = maid.logger # TODO: Maybe it's better to create seperate loggers?
  @path = File.expand_path(path)
  initialize_rules(&rules)
end

Public Instance Methods

join() click to toggle source
# File lib/maid/watch.rb, line 28
def join
  @listener.thread.join unless @listener.nil? || @listener.paused?
end
run() click to toggle source
# File lib/maid/watch.rb, line 15
def run
  unless rules.empty?
    @listener = Listen.to(path, @options) do |modified, added, removed|
      follow_rules(modified, added, removed)
    end
    @listener.start
  end
end
stop() click to toggle source
# File lib/maid/watch.rb, line 24
def stop
  @listener.stop
end