Tools

A library of utility services and concerns.

Class: SleepingKingStudios::Tools::Messages::Registry

Parent Namespace
SleepingKingStudios::Tools::Messages
Defined In
lib/sleeping_king_studios/tools/messages/registry.rb

Table Of Contents

Overview

Matches defined message strategies by message scope.

Back To Top

Defined Under Namespace

Classes
Node, StrategyAlreadyExistsError

Back To Top

Class Methods

.global() => Registry

Returns a singleton instance of the messages registry, instantiating the instance if needed.

Returns

Back To Top

Constructor

#initialize => Registry

Returns

Back To Top

Instance Methods

#get(scope) => SleepingKingStudios::Tools::Messages::Strategy, nil

Also known as: []

Returns the strategy matching the given scope or key.

The returned strategy will match the longest defined scope that matches the given key.

Parameters

Returns

#register(scope:, strategy:, force: false) => self
#register(scope:, hash:, force: false) => Object
#register(scope:, file:, force: false) => Object

Also known as: add

Overloads

#register(scope:, strategy:, force: false) => self

Adds a strategy to the registry with the given scope.

Parameters
  • scope (String) — the scope for the strategy.
  • strategy (SleepingKingStudios::Tools::Messages::Strategy) — the strategy to register.
  • force (true, false) — if true, overrides an existing strategy with the given scope. Defaults to false.
Returns
  • (self) — the registry.
#register(scope:, hash:, force: false) => Object
#register(scope:, file:, force: false) => Object

#strategies => Hash

Returns

Back To Top


Back to Documentation | Reference | SleepingKingStudios | SleepingKingStudios::Tools | SleepingKingStudios::Tools::Messages