Class: Rapid::Services::Root

Inherits:
Set show all
Extended by:
Forwardable
Defined in:
lib/ury_rapid/services/root.rb

Overview

The root service

This is the main service in the Rapid system, and owns all other services as well as the root of the model tree.

Instance Attribute Summary

Attributes inherited from Set

#constructor_arguments, #model_builder

Instance Method Summary collapse

Methods inherited from Set

#configure, #disabled, #enable, #enable_all, #group, #start, #start_enabled

Constructor Details

#initialize(logger, *args) ⇒ Root

Returns a new instance of Root


12
13
14
15
# File 'lib/ury_rapid/services/root.rb', line 12

def initialize(logger, *args)
  super(*args)
  @logger = logger
end

Instance Method Details

#make_modelObject


28
29
30
31
32
33
34
35
36
37
38
# File 'lib/ury_rapid/services/root.rb', line 28

def make_model
  logger = @logger
  environment.insert_components('/') do
    tree :info, :info do
      ver = Rapid::Common::Constants::VERSION
      constant :version, ver, :version
    end

    log :log, logger
  end
end

#runObject


17
18
19
20
21
22
23
24
25
26
# File 'lib/ury_rapid/services/root.rb', line 17

def run
  fail 'Nil logger provided.' if @logger.nil?

  make_model

  environment.log(:info, 'Now starting Rapid.')
  environment.log(:info, "Version: #{Rapid::Common::Constants::VERSION}.")

  super
end