Class: TriggerSwitchD::Application
- Inherits:
-
Object
- Object
- TriggerSwitchD::Application
- Defined in:
- lib/trigger_switch_d/application.rb
Overview
starts an instance of the daemon.
Constant Summary collapse
- ANYTHING_STR =
"anything"
- RESPONSE_STR =
"response"
- RECEIVED_STR =
"received"
Instance Attribute Summary collapse
-
#devices ⇒ Object
(also: #list_devices)
readonly
Returns the value of attribute devices.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#schedule ⇒ Object
readonly
Returns the value of attribute schedule.
Instance Method Summary collapse
-
#initialize(config_file) ⇒ Application
constructor
Prepares the run by loading up the environment located in config/config.rb.
-
#list_schedule ⇒ Object
:nodoc:.
-
#start ⇒ Object
Runs the daemon untill process killed or it receives stop from client connected via unix socket.
Constructor Details
#initialize(config_file) ⇒ Application
Prepares the run by loading up the environment located in config/config.rb
32 33 34 35 36 37 |
# File 'lib/trigger_switch_d/application.rb', line 32 def initialize(config_file) @current_date = Date.new ConfigFactory.new(config_file) @logger = Logger.new(Config.log_object) logger.info("Environment prepared") end |
Instance Attribute Details
#devices ⇒ Object (readonly) Also known as: list_devices
Returns the value of attribute devices.
27 28 29 |
# File 'lib/trigger_switch_d/application.rb', line 27 def devices @devices end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
27 28 29 |
# File 'lib/trigger_switch_d/application.rb', line 27 def logger @logger end |
#schedule ⇒ Object (readonly)
Returns the value of attribute schedule.
27 28 29 |
# File 'lib/trigger_switch_d/application.rb', line 27 def schedule @schedule end |
Instance Method Details
#list_schedule ⇒ Object
:nodoc:
51 52 53 |
# File 'lib/trigger_switch_d/application.rb', line 51 def list_schedule #:nodoc: schedule.by_name.keys end |
#start ⇒ Object
Runs the daemon untill process killed or it receives stop from client connected via unix socket
44 45 46 47 48 49 |
# File 'lib/trigger_switch_d/application.rb', line 44 def start @ipc = IPC.create(Config.unix_socket_path) @logger.info("IPC started") __run_loop__ @logger.info("Received stop via IPC") end |