class Falcon::Service::Generic
Captures the stateful behaviour of a specific service. Specifies the interfaces required by derived classes.
Designed to be invoked within an {Async::Controller::Container}.
Public Class Methods
Initialize the service from the given environment. @parameter environment [Build::Environment]
# File lib/falcon/service/generic.rb, line 41 def initialize(environment) @environment = environment @evaluator = @environment.evaluator end
Convert the given environment into a service if possible. @parameter environment [Build::Environment] The environment to use to construct the service.
# File lib/falcon/service/generic.rb, line 32 def self.wrap(environment) evaluator = environment.evaluator service = evaluator.service || self return service.new(environment) end
Public Instance Methods
Whether the service environment contains the specified keys. This is used for matching environment configuration to service behaviour.
# File lib/falcon/service/generic.rb, line 48 def include?(keys) keys.all?{|key| @environment.include?(key)} end
The logger to use for this service. @returns [Console::Logger]
# File lib/falcon/service/generic.rb, line 60 def logger return Console.logger # .with(name: name) end
The name of the service. e.g. `myapp.com`.
# File lib/falcon/service/generic.rb, line 54 def name @evaluator.name end
Setup the service into the specified container. @parameter container [Async::Container::Generic]
# File lib/falcon/service/generic.rb, line 70 def setup(container) end
Start the service.
# File lib/falcon/service/generic.rb, line 65 def start end
Stop the service.
# File lib/falcon/service/generic.rb, line 74 def stop end