Module: Axn::Core::ToolDeclaration

Defined in:
lib/axn/core/tool_declaration.rb

Overview

Tool membership (the tool DSL) and the canonical, provider-safe tool_name derivation. Every Axn is a potential tool; the registry (Axn::Tools::Registry) decides which classes an adapter actually exposes, reading the storage declared here.

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/axn/core/tool_declaration.rb', line 9

def self.included(base)
  base.class_eval do
    # instance_accessor: false — class-level DSL, not per-instance state.
    # _tool_declaration: nil (undeclared) | :all | false | Array<Symbol> (explicit adapters).
    class_attribute :_tool_declaration, :_tool_name_override, instance_accessor: false, default: nil

    # Per-adapter provider-name overrides ({adapter => raw_name}), rebuilt fresh on each `tool`
    # call. A class_attribute so a subclass inherits the parent's tool identity until it redeclares
    # `tool`. Frozen default: never mutate in place, always assign a fresh hash.
    class_attribute :_tool_name_overrides, instance_accessor: false, default: {}.freeze

    # Per-adapter opt-out ({adapter}), rebuilt fresh on each `tool` call. Subtracted from the
    # union of directory + declaration grants at membership time. class_attribute so a subclass
    # inherits until it redeclares; frozen default, never mutated in place.
    class_attribute :_tool_except, instance_accessor: false, default: [].freeze
    extend ClassMethods
  end
end