Class: FSSM::Monitor
- Inherits:
-
Object
- Object
- FSSM::Monitor
- Defined in:
- lib/fssm/monitor.rb
Instance Method Summary collapse
- #file(path = nil, glob = nil, &block) ⇒ Object
-
#initialize(options = {}) ⇒ Monitor
constructor
A new instance of Monitor.
- #path(path = nil, glob = nil, &block) ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Monitor
Returns a new instance of Monitor.
2 3 4 5 |
# File 'lib/fssm/monitor.rb', line 2 def initialize(={}) = @backend = FSSM::Backends::Default.new end |
Instance Method Details
#file(path = nil, glob = nil, &block) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/fssm/monitor.rb', line 16 def file(path=nil, glob=nil, &block) path = create_path(path, glob, &block) @backend.add_handler(FSSM::State::File.new(path)) path rescue FSSM::FileNotRealError => e FSSM.dbg("#{e}") nil end |
#path(path = nil, glob = nil, &block) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/fssm/monitor.rb', line 7 def path(path=nil, glob=nil, &block) path = create_path(path, glob, &block) @backend.add_handler(FSSM::State::Directory.new(path, )) path rescue FSSM::FileNotRealError => e FSSM.dbg("#{e}") nil end |
#run ⇒ Object
25 26 27 |
# File 'lib/fssm/monitor.rb', line 25 def run @backend.run end |