Sha256: 5cc03fdecfad156a071cb7b8a1e5f97310bf54bed4af9aa2c4d6412c81cb5c28
Contents?: true
Size: 678 Bytes
Versions: 13
Compression:
Stored size: 678 Bytes
Contents
require 'listen' class Maid::Watch include Maid::RuleContainer attr_reader :path, :listener, :logger 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 def run unless rules.empty? @listener = Listen.to(path, @options) do |modified, added, removed| follow_rules(modified, added, removed) end @listener.start end end def stop @listener.stop end def join @listener.thread.join unless @listener.nil? || @listener.paused? end end
Version data entries
13 entries across 13 versions & 1 rubygems