Module: FSR::App
- Included in:
- Listener::Outbound
- Defined in:
- lib/fsr/app.rb,
lib/fsr/app/log.rb,
lib/fsr/app/set.rb,
lib/fsr/app/fifo.rb,
lib/fsr/app/speak.rb,
lib/fsr/app/answer.rb,
lib/fsr/app/bridge.rb,
lib/fsr/app/hangup.rb,
lib/fsr/app/fs_break.rb,
lib/fsr/app/fs_sleep.rb,
lib/fsr/app/playback.rb,
lib/fsr/app/transfer.rb,
lib/fsr/app/conference.rb
Defined Under Namespace
Classes: Answer, Application, Bridge, Conference, FSBreak, FSSleep, Fifo, Hangup, Log, Playback, Set, Speak, Transfer
Constant Summary
collapse
- APPLICATIONS =
{}
- LOAD_PATH =
[FSR::ROOT.join("fsr/app")]
- REGISTER_CODE =
"def %s(*args, &block); APPLICATIONS[%p].new(*args, &block); end"
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.list ⇒ Object
33
34
35
|
# File 'lib/fsr/app.rb', line 33
def self.list
APPLICATIONS.keys
end
|
.load_all(force_reload = false) ⇒ Object
Load all of the applications we find in App::LOAD_PATH
57
58
59
60
61
62
63
64
65
|
# File 'lib/fsr/app.rb', line 57
def self.load_all(force_reload = false)
glob = "{#{LOAD_PATH.join(',')}}/*.{so,rb,bundle}"
Dir[glob].each do |file|
force_reload ? load(file) : require(file)
end
list
end
|
.load_application(application, force_reload = false) ⇒ Object
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/fsr/app.rb', line 37
def self.load_application(application, force_reload = false)
exception = nil
if Pathname(application).absolute?
glob = application
else
glob = "{#{LOAD_PATH.join(',')}}/#{application}.{so,rb,bundle}"
end
Dir[glob].each do |file|
begin
return force_reload ? load(file) : require(file)
rescue LoadError => exception
end
end
raise("Couldn't find %s in %p" % [application, LOAD_PATH])
end
|
.register(application, obj) ⇒ Object
26
27
28
29
30
31
|
# File 'lib/fsr/app.rb', line 26
def self.register(application, obj)
APPLICATIONS[application.to_sym] = obj
code = REGISTER_CODE % [application, application]
App.module_eval(code)
end
|
Instance Method Details
#applications ⇒ Object
67
68
69
|
# File 'lib/fsr/app.rb', line 67
def applications
FSR::App.list
end
|