Module: Stoplight::Domain::_LightFactory

Included in:
Wiring::LightFactory, Wiring::System::LightFactory::InternalLightFactory
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

Instance Method Details

#==Boolean

Parameters:

  • (Object)

Returns:

  • (Boolean)


77
# File 'sig/_private/stoplight/domain/ports/light_factory.rbs', line 77

def ==: (untyped) -> bool

#buildLight

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.

Returns:

Raises:



47
# File 'sig/_private/stoplight/domain/ports/light_factory.rbs', line 47

def build: -> Light

#build_withObject

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.

Examples:

Usage

# Instead of:
new_factory = factory.with(threshold: 10)
light = new_factory.build

# You can do:
light = factory.build_with(threshold: 10)


62
# File 'sig/_private/stoplight/domain/ports/light_factory.rbs', line 62

def build_with: (

#withObject

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: (