Module: Protege::Manifested::ClassMethods
- Defined in:
- lib/protege/extensions/manifested.rb
Overview
Class-level metadata surface added to every extension base.
Instance Method Summary collapse
-
#description(value = nil) ⇒ String?
A natural-language description of the extension: the declared value, or nil when unset.
-
#display_name(value = nil) ⇒ String
A human-readable label for the dashboard: the declared name, or the titleized id by default.
-
#id ⇒ Symbol
The extension's stable symbolic id — the manifest key a binding references and the dashboard shows.
-
#manifest_id(value) ⇒ Symbol
Declare an explicit id, overriding the name-derived default.
-
#registered ⇒ Array<Class>
The loaded, named concrete subclasses of this extension base — its registry.
-
#summary(value = nil) ⇒ String?
A short, human-facing one-liner for the dashboard — what an operator reads when picking this extension.
Instance Method Details
#description(value = nil) ⇒ String?
A natural-language description of the extension: the declared value, or nil when unset. Pass a value to set it. For a tool this is the LLM-facing text published in the model's tool schema — verbose and model-directed. For a short, human-facing dashboard blurb, use #summary instead.
54 55 56 57 58 |
# File 'lib/protege/extensions/manifested.rb', line 54 def description(value = nil) return @description if value.nil? @description = value end |
#display_name(value = nil) ⇒ String
A human-readable label for the dashboard: the declared name, or the titleized id by default. Pass a value to set it.
42 43 44 45 46 |
# File 'lib/protege/extensions/manifested.rb', line 42 def display_name(value = nil) return @display_name || id.to_s.titleize if value.nil? @display_name = value end |
#id ⇒ Symbol
The extension's stable symbolic id — the manifest key a binding references and the dashboard
shows. Defaults to the class basename with a trailing +Tool+/+Provider+/+Hook+/+Resolver+ suffix
stripped and the rest snake_cased; override with #manifest_id when the id must be explicit (a
provider, whose id is matched against config.provider_id). Memoized per class.
25 26 27 |
# File 'lib/protege/extensions/manifested.rb', line 25 def id @id ||= name.demodulize.sub(/(?:Tool|Provider|Hook|Resolver)\z/, '').underscore.to_sym end |
#manifest_id(value) ⇒ Symbol
Declare an explicit id, overriding the name-derived default.
33 34 35 |
# File 'lib/protege/extensions/manifested.rb', line 33 def manifest_id(value) @id = value.to_sym end |
#registered ⇒ Array<Class>
The loaded, named concrete subclasses of this extension base — its registry. Anonymous classes (nil name) are skipped; descendant-based so it survives Zeitwerk reloads without bookkeeping.
76 77 78 |
# File 'lib/protege/extensions/manifested.rb', line 76 def registered descendants.reject { _1.name.nil? } end |
#summary(value = nil) ⇒ String?
A short, human-facing one-liner for the dashboard — what an operator reads when picking this extension. Distinct from #description, which for tools is the verbose text sent to the model. The declared value, or nil when unset. Pass a value to set it.
66 67 68 69 70 |
# File 'lib/protege/extensions/manifested.rb', line 66 def summary(value = nil) return @summary if value.nil? @summary = value end |