Module: Stoplight::Domain::_LightFactory
- Defined in:
- sig/_private/stoplight/domain/ports/light_factory.rbs
Overview
Abstract factory protocol for building Stoplight::Light instances.
This defines the interface that any Light factory must implement, regardless of the underlying implementation details.
This uses the Abstract Factory pattern to decouple the domain (Light) from the application layer (concrete factory implementation). Light doesn't know HOW it's built, only that it needs something that can build variants of itself.
By defining this interface in the domain layer:
- Light can request reconfiguration without knowing about containers
- Different factory implementations can be swapped (code, database-configured, etc.)
- Dependency direction is preserved (Application → Domain, not Domain → Application)
Instance Method Summary collapse
- #== ⇒ Boolean
-
#build ⇒ Light
Builds a Light instance with the current configuration.
-
#build_with ⇒ Object
Convenience method to configure and build in one operation.
-
#with ⇒ Object
Creates a new factory with modified settings.
Instance Method Details
#== ⇒ Boolean
77 |
# File 'sig/_private/stoplight/domain/ports/light_factory.rbs', line 77
def ==: (untyped) -> bool
|
#build ⇒ Light
Builds a Light instance with the current configuration.
This method must construct a fully-wired Light with all required dependencies (strategies, data store, notifiers, etc.). The Light should be ready to use immediately after construction.
47 |
# File 'sig/_private/stoplight/domain/ports/light_factory.rbs', line 47
def build: -> Light
|
#build_with ⇒ Object
Convenience method to configure and build in one operation.
This combines #with and #build into a single call, which is
useful when you want to create a customized Light without keeping
a reference to the intermediate factory.
62 |
# File 'sig/_private/stoplight/domain/ports/light_factory.rbs', line 62
def build_with: (
|
#with ⇒ Object
Creates a new factory with modified settings.
This method must return a NEW factory instance - it should not modify the current factory. The new factory should inherit all configuration from the current factory, with the provided settings overriding specific values.
25 |
# File 'sig/_private/stoplight/domain/ports/light_factory.rbs', line 25
def with: (
|