Module: Protege::ProviderMixin::ClassMethods

Defined in:
lib/protege/extensions/provider_mixin.rb

Overview

Class-level DSL provided by the mixin.

Instance Method Summary collapse

Instance Method Details

#idSymbol

Return the declared symbolic id.

Returns:

  • (Symbol)

    the id set via protege_id.

Raises:



116
117
118
119
120
121
# File 'lib/protege/extensions/provider_mixin.rb', line 116

def id
  @protege_id || raise(
    Protege::ContractViolationError,
    "#{self} must declare its id with `protege_id :<symbol>` inside the class body"
  )
end

#protege_id(symbol) ⇒ Symbol

Declare the symbolic identifier this provider responds to.

Call inside the class body; the configured provider_id references the provider by this symbol.

Parameters:

  • symbol (Symbol)

    the provider's unique identifier (e.g. :openrouter).

Returns:

  • (Symbol)

    the stored identifier.



108
109
110
# File 'lib/protege/extensions/provider_mixin.rb', line 108

def protege_id(symbol)
  @protege_id = symbol
end