lib/longleaf/services/service_definition_manager.rb in longleaf-0.2.0.pre.1 vs lib/longleaf/services/service_definition_manager.rb in longleaf-0.3.0
- old
+ new
@@ -4,21 +4,21 @@
module Longleaf
# Manager which loads and provides access to Longleaf::ServiceDefinition objects
class ServiceDefinitionManager
SF ||= Longleaf::ServiceFields
AF ||= Longleaf::AppFields
-
+
# Hash containing the set of configured services, represented as {ServiceDefinition} objects
attr_reader :services
-
+
# @param config [Hash] hash representation of the application configuration
def initialize(config)
raise ArgumentError.new("Configuration must be provided") if config.nil? || config.empty?
services_config = config[AF::SERVICES]
raise ArgumentError.new("Services configuration must be provided") if services_config.nil?
-
+
@services = Hash.new
config[AF::SERVICES].each do |name, properties|
work_script = properties.delete(SF::WORK_SCRIPT)
work_class = properties.delete(SF::WORK_CLASS)
frequency = properties.delete(SF::FREQUENCY)
@@ -28,13 +28,12 @@
work_script: work_script,
work_class: work_class,
frequency: frequency,
delay: delay,
properties: properties)
-
+
@services[name] = service
end
@services.freeze
end
-
end
-end
\ No newline at end of file
+end