Module: FSSM

Defined in:
lib/fssm/pathname.rb,
lib/fssm.rb

Overview

The bundled ruby pathname library is a slow and hideous beast. There. I said it. This version is based on pathname3.

Defined Under Namespace

Modules: Backends, Support, Tree Classes: Monitor, Path, Pathname, State

Constant Summary collapse

FileNotFoundError =
Class.new(StandardError)
CallbackError =
Class.new(StandardError)

Class Method Summary collapse

Class Method Details

.dbg(msg = nil) ⇒ Object



9
10
11
# File 'lib/fssm.rb', line 9

def dbg(msg=nil)
  STDERR.puts(msg)
end

.monitor(*args, &block) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/fssm.rb', line 13

def monitor(*args, &block)      
  monitor = FSSM::Monitor.new
  context = args.empty? ? monitor : monitor.path(*args)

  if block_given?
    if block.arity == 1
      block.call(context)
    else
      context.instance_eval(&block)
    end
  end

  monitor.run
end