Module: Assistant::InputBuilder::Registry

Included in:
Assistant::InputBuilder
Defined in:
lib/assistant/input_builder/registry.rb

Overview

Per-class registry of input definitions. Each Service subclass gets its own hash keyed by attribute name with the original keyword options frozen for introspection (used by Service#initialize for M1 defaulting and by the M11 RBS generator).

Instance Method Summary collapse

Instance Method Details

#input_definitionsHash{Symbol => Hash}

Per-class hash of input definitions, keyed by attribute name. Values are frozen { type:, **options } hashes. Read by Service#initialize (M1 defaulting), by Service#input_snapshot (M-S4), and by the M11 RBS generator.

Returns:

  • (Hash{Symbol => Hash})


14
15
16
# File 'lib/assistant/input_builder/registry.rb', line 14

def input_definitions
  @input_definitions ||= {}
end

#register_input_definition(name:, type:, options:) ⇒ Hash

Register or replace an input definition.

Parameters:

  • name (Symbol)

    input name

  • type (Class, Array<Class>)

    declared type(s)

  • options (Hash)

    remaining #input keyword options

Returns:

  • (Hash)

    the frozen definition entry just stored



24
25
26
# File 'lib/assistant/input_builder/registry.rb', line 24

def register_input_definition(name:, type:, options:)
  input_definitions[name] = { type:, **options }.freeze
end