Class: FSSM::Monitor

Inherits:
Object
  • Object
show all
Defined in:
lib/fssm/monitor.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Monitor

Returns a new instance of Monitor.



2
3
4
5
# File 'lib/fssm/monitor.rb', line 2

def initialize(options={})
  @options = options
  @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, @options))
  path
rescue FSSM::FileNotRealError => e
  FSSM.dbg("#{e}")
  nil
end

#runObject



25
26
27
# File 'lib/fssm/monitor.rb', line 25

def run
  @backend.run
end