Class: RMB::ListenerClient

Inherits:
Object
  • Object
show all
Defined in:
lib/listener_client.rb

Overview

This code is called from the client application. It starts/stops the daemon via a control script

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ ListenerClient

Returns a new instance of ListenerClient.



8
9
10
# File 'lib/listener_client.rb', line 8

def initialize(hash)
  @hash = hash
end

Instance Method Details

#app_nameObject



27
28
29
# File 'lib/listener_client.rb', line 27

def app_name
  @hash[:daemon_options][:app_name]
end

#control(action) ⇒ Object



20
21
22
23
24
25
# File 'lib/listener_client.rb', line 20

def control(action)
  setup
  control_script = "ruby #{File.dirname(__FILE__)}/#{RMB::Properties.daemon_prefix}control.rb #{action}"
  control_params = "#{@hash[:working_dir]} #{@hash[:key]}"
  system("#{control_script} #{control_params} -- #{control_params}")
end

#propertiesObject



35
36
37
# File 'lib/listener_client.rb', line 35

def properties
  @hash
end

#properties=(hash) ⇒ Object



31
32
33
# File 'lib/listener_client.rb', line 31

def properties=(hash)
  @hash=hash
end

#startObject



12
13
14
# File 'lib/listener_client.rb', line 12

def start
  control('start')
end

#stopObject



16
17
18
# File 'lib/listener_client.rb', line 16

def stop
  control('stop')
end