Class: CelluloidIOPGListener::SupervisionConfigurationSignature
- Inherits:
-
Object
- Object
- CelluloidIOPGListener::SupervisionConfigurationSignature
- Includes:
- Celluloid::Internals::Logger
- Defined in:
- lib/celluloid-io-pg-listener/supervision_configuration_signature.rb
Overview
Usage:
config_path = [:config_path] || "config/settings.yml"
config_signature = CelluloidIOPGListener::SupervisionConfigurationSignature.new(path_to_yaml: config_path).signature
supervision_config = Celluloid::Supervision::Configuration.define(*config_signature)
supervision_config.deploy
Instance Attribute Summary collapse
-
#supervision_config ⇒ Object
readonly
Returns the value of attribute supervision_config.
-
#yaml_config ⇒ Object
readonly
Returns the value of attribute yaml_config.
Instance Method Summary collapse
-
#initialize(path_to_yaml: nil, yaml_hash: nil) ⇒ SupervisionConfigurationSignature
constructor
A new instance of SupervisionConfigurationSignature.
-
#signature ⇒ Object
Returns an array like this: [ { type: MyActor, as: :my_actor, args: [] }, { type: MyActor, as: :my_actor_with_args, args: [ :one_arg, :two_args ] }, ].
Constructor Details
#initialize(path_to_yaml: nil, yaml_hash: nil) ⇒ SupervisionConfigurationSignature
Returns a new instance of SupervisionConfigurationSignature.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/celluloid-io-pg-listener/supervision_configuration_signature.rb', line 18 def initialize(path_to_yaml: nil, yaml_hash: nil) @yaml_config = yaml_hash || YAML::load(ERB.new(File.read(path_to_yaml)).result) # config may be the whole yaml / hash, or it may be nested. # If nested it is value of the key "listening_group". @yaml_config = @yaml_config["listening_group"] if @yaml_config["listening_group"] unless @yaml_config.nil? @yaml_config = @yaml_config.dup # Don't want to mutate anything that was passed in @supervision_config = process_yaml_config end end |
Instance Attribute Details
#supervision_config ⇒ Object (readonly)
Returns the value of attribute supervision_config.
16 17 18 |
# File 'lib/celluloid-io-pg-listener/supervision_configuration_signature.rb', line 16 def supervision_config @supervision_config end |
#yaml_config ⇒ Object (readonly)
Returns the value of attribute yaml_config.
15 16 17 |
# File 'lib/celluloid-io-pg-listener/supervision_configuration_signature.rb', line 15 def yaml_config @yaml_config end |
Instance Method Details
#signature ⇒ Object
Returns an array like this:
[
{
type: MyActor,
as: :my_actor,
args: []
},
{
type: MyActor,
as: :my_actor_with_args,
args: [
:one_arg,
:two_args
]
},
]
45 46 47 |
# File 'lib/celluloid-io-pg-listener/supervision_configuration_signature.rb', line 45 def signature supervision_config end |