Class: Lokii::Server
- Inherits:
-
Object
show all
- Defined in:
- lib/lokii/server.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#handlers ⇒ Object
Returns the value of attribute handlers.
3
4
5
|
# File 'lib/lokii/server.rb', line 3
def handlers
@handlers
end
|
#ready ⇒ Object
Returns the value of attribute ready.
3
4
5
|
# File 'lib/lokii/server.rb', line 3
def ready
@ready
end
|
#stopped ⇒ Object
Returns the value of attribute stopped.
3
4
5
|
# File 'lib/lokii/server.rb', line 3
def stopped
@stopped
end
|
Instance Method Details
#check ⇒ Object
51
52
53
|
# File 'lib/lokii/server.rb', line 51
def check
Lokii::Logger.debug "Checking for incoming messages" if Lokii::Config.verbose
end
|
#complete(message) ⇒ Object
47
48
49
|
# File 'lib/lokii/server.rb', line 47
def complete(message)
Lokii::Logger.debug "Message processing complete" if Lokii::Config.verbose
end
|
#connect ⇒ Object
35
36
37
|
# File 'lib/lokii/server.rb', line 35
def connect
Lokii::Logger.debug "Connecting"
end
|
#daemon? ⇒ Boolean
31
32
33
|
# File 'lib/lokii/server.rb', line 31
def daemon?
defined?(LOKII_DAEMON) && LOKII_DAEMON
end
|
#disconnect ⇒ Object
39
40
41
|
# File 'lib/lokii/server.rb', line 39
def disconnect
Lokii::Logger.debug "Disconnecting"
end
|
#process ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/lokii/server.rb', line 19
def process
return if stopped?
return unless running?
setup unless ready?
check
end
|
#ready? ⇒ Boolean
5
6
7
|
# File 'lib/lokii/server.rb', line 5
def ready?
defined?(@ready) && @ready
end
|
#running? ⇒ Boolean
27
28
29
|
# File 'lib/lokii/server.rb', line 27
def running?
File.exist?(File.join(Lokii::Config.root, Lokii::Config.pid).gsub(File::SEPARATOR, File::ALT_SEPARATOR || File::SEPARATOR))
end
|
#say(text, number, reply = nil) ⇒ Object
43
44
45
|
# File 'lib/lokii/server.rb', line 43
def say(text, number, reply = nil)
Lokii::Logger.debug "Sending message to #{number}"
end
|
#setup ⇒ Object
13
14
15
16
17
|
# File 'lib/lokii/server.rb', line 13
def setup
self.ready = true
Lokii::Logger.debug "Initializing"
Lokii::Logger.debug "Waiting for text messages"
end
|
#stopped? ⇒ Boolean
9
10
11
|
# File 'lib/lokii/server.rb', line 9
def stopped?
defined?(@stopped) && @stopped
end
|