Module: Butler::Service
Instance Attribute Summary collapse
Attributes included from Log::Comfort
#logger
Instance Method Summary
collapse
#debug, #error, #exception, #fail, #info, #log, #warn
Instance Attribute Details
#butler ⇒ Object
Returns the value of attribute butler.
18
19
20
|
# File 'lib/butler/service.rb', line 18
def butler
@butler
end
|
#name ⇒ Object
Returns the value of attribute name.
20
21
22
|
# File 'lib/butler/service.rb', line 20
def name
@name
end
|
#path ⇒ Object
Returns the value of attribute path.
19
20
21
|
# File 'lib/butler/service.rb', line 19
def path
@path
end
|
#rdn ⇒ Object
Returns the value of attribute rdn.
21
22
23
|
# File 'lib/butler/service.rb', line 21
def rdn
@rdn
end
|
#version ⇒ Object
Returns the value of attribute version.
22
23
24
|
# File 'lib/butler/service.rb', line 22
def version
@version
end
|
Instance Method Details
#at(*args, &block) ⇒ Object
48
49
50
|
# File 'lib/butler/service.rb', line 48
def at(*args, &block)
@butler.scheduler.at(*args, &block)
end
|
#every(*args, &block) ⇒ Object
44
45
46
|
# File 'lib/butler/service.rb', line 44
def every(*args, &block)
@butler.scheduler.every(*args, &block)
end
|
#load_service(butler, path, rdn, name, version) ⇒ Object
this method is called to initialize the plugin-class, do not override
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/butler/service.rb', line 26
def load_service(butler, path, rdn, name, version) @butler = butler
@path = OpenStruct.new(
:base => path,
:fixtures => path+'/fixtures.rb'
)
@name = name
@rdn = rdn
@version = version
@listener = []
load(@path.fixtures) if File.exist?(@path.fixtures)
info("Loaded service #{@rdn} '#{@name}':#{@version} (#{self})")
end
|
#on_disconnect(*args) ⇒ Object
70
|
# File 'lib/butler/service.rb', line 70
def on_disconnect(*args); end
|
#on_load(*args) ⇒ Object
68
|
# File 'lib/butler/service.rb', line 68
def on_load(*args); end
|
#on_login(*args) ⇒ Object
69
|
# File 'lib/butler/service.rb', line 69
def on_login(*args); end
|
#on_quit(*args) ⇒ Object
71
|
# File 'lib/butler/service.rb', line 71
def on_quit(*args); end
|
#on_unload(*args) ⇒ Object
72
|
# File 'lib/butler/service.rb', line 72
def on_unload(*args); end
|
#register(object) ⇒ Object
40
41
42
|
# File 'lib/butler/service.rb', line 40
def register(object)
@butler.services.register(self, object)
end
|
#subscribe(*args, &block) ⇒ Object
56
57
58
59
60
|
# File 'lib/butler/service.rb', line 56
def subscribe(*args, &block)
listener = @butler.subscribe(*args, &block)
@listener << listener
listener
end
|
#timed(*args, &block) ⇒ Object
52
53
54
|
# File 'lib/butler/service.rb', line 52
def timed(*args, &block)
@butler.scheduler.timed(*args, &block)
end
|
#unload_plugin ⇒ Object
62
63
64
65
66
|
# File 'lib/butler/service.rb', line 62
def unload_plugin
info("Unloading plugin '#{@base}' (#{self})")
@commands.each { |command| @butler.delete_command(command) }
@listener.each { |listener| listener.unsubscribe }
end
|