Module: IMP
- Extended by:
- IMP
- Included in:
- IMP
- Defined in:
- lib/imp.rb,
lib/api/open.rb,
lib/api/ping.rb,
lib/api/port.rb,
lib/api/version.rb,
lib/daemon/stop.rb,
lib/client/close.rb,
lib/daemon/start.rb,
lib/client/request.rb,
lib/api/stop_daemon.rb,
lib/client/listener.rb,
lib/api/start_daemon.rb,
lib/client/responded.rb,
lib/client/initialize.rb,
lib/daemon/handler/each.rb,
lib/daemon/handler/close.rb,
lib/daemon/handler/event.rb,
lib/daemon/handler/respond.rb,
lib/daemon/handler/initialize.rb
Constant Summary collapse
- PORT =
12345- VERSION =
"0.0.0"- @@client =
nil
Instance Method Summary collapse
- #close ⇒ Object
- #open ⇒ Object
- #ping(*args, &hook) ⇒ Object
- #start_daemon ⇒ Object
- #stop_daemon ⇒ Object
Instance Method Details
#close ⇒ Object
13 14 15 16 17 18 |
# File 'lib/api/open.rb', line 13 def close return if @@client.nil? @@client.close @@client = nil true end |
#open ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/api/open.rb', line 3 def open return unless @@client.nil? begin @@client = Client.new return true rescue return false end end |
#ping(*args, &hook) ⇒ Object
2 3 4 |
# File 'lib/api/ping.rb', line 2 def ping *args, &hook @@client&.request('ping', args, &hook) end |
#start_daemon ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/api/start_daemon.rb', line 3 def start_daemon begin Daemon.start nil return true rescue return false end end |
#stop_daemon ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/api/stop_daemon.rb', line 2 def stop_daemon if @@client.nil? and open == false # no daemon running return end case @@client.request('stop', nil) when NilClass # not thoroughly implemented yet # nil is automatically assigned to all requests when disconnected @@client = nil true else # not thoroughly implemented yet # e.g. permissions false end end |