Module: FSSM::Backends
- Defined in:
- lib/fssm.rb,
lib/fssm/backends/inotify.rb,
lib/fssm/backends/polling.rb,
lib/fssm/backends/rbfsevent.rb
Defined Under Namespace
Classes: Inotify, Polling, RBFSEvent
Class Method Summary
collapse
Class Method Details
.const_missing(symbol) ⇒ Object
53
54
55
|
# File 'lib/fssm.rb', line 53
def const_missing(symbol)
symbol == :Default ? set_backend(symbol, FSSM::Support.backend) : super
end
|
.set_backend(const_symbol = nil, value = nil) ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/fssm.rb', line 32
def set_backend(const_symbol=nil, value=nil)
const_symbol ||= :Default
value ||= ::FSSM::Support.backend
if (value.is_a?(Symbol) || value.is_a?(String))
unless const_defined?(value)
raise NameError,
"uninitialized constant FSSM::Backends::#{value}"
end
value = const_get(value)
end
unless value.is_a?(Class)
raise ArgumentError,
"value must be a class or the symbol of an existing backend"
end
remove_const(const_symbol) if const_defined?(const_symbol)
const_set(const_symbol, value)
end
|