class Sicily::MonitorWrapper
Public Class Methods
can_monitor?(prev_paths, new_path)
click to toggle source
# File lib/sicily/monitor_wrapper.rb, line 30 def self.can_monitor?(prev_paths, new_path) prev_paths.each do |prev_path| return false if somehow_related?(prev_path, new_path) end true end
on(path, &user_rule_block)
click to toggle source
# File lib/sicily/monitor_wrapper.rb, line 7 def self.on(path, &user_rule_block) if can_monitor?(@monitored_paths, path) store_path_and_start_monitor(path, &user_rule_block) else Sicily.logger.error "Monitor Failed. Path duplicated : #{path}" end end
start_monitor!(path, &user_rule_block)
click to toggle source
# File lib/sicily/monitor_wrapper.rb, line 20 def self.start_monitor!(path, &user_rule_block) Monitor.new.on(path, &user_rule_block) rescue MonitorError => e Sicily.logger.error e.inspect end
store_monitored_path(path)
click to toggle source
# File lib/sicily/monitor_wrapper.rb, line 26 def self.store_monitored_path(path) @monitored_paths << File.expand_path(path) end
store_path_and_start_monitor(path, &user_rule_block)
click to toggle source
# File lib/sicily/monitor_wrapper.rb, line 15 def self.store_path_and_start_monitor(path, &user_rule_block) store_monitored_path(path) start_monitor!(path, &user_rule_block) end