Class: AgentSettings::Location

Inherits:
Data
  • Object
show all
Defined in:
lib/agent_settings/location.rb

Overview

Represents a config file location for an agent.

A Location describes where a configuration file is (or would be) stored, whether it exists, and whether it's the currently active configuration. Locations are organized by scope (global vs project) and source (user, system, file, etc.).

Examples:

location = Location.new(
  agent: :claude,
  scope: :global,
  source: 'user',
  path: '/Users/me/.claude/settings.json',
  exists: true,
  active: true,
  note: nil
)
location.exists?  #=> true
location.active?  #=> true

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#activeBoolean (readonly)

whether this is the currently effective config location

Returns:

  • (Boolean)

    the current value of active



31
32
33
# File 'lib/agent_settings/location.rb', line 31

def active
  @active
end

#agentSymbol (readonly)

the agent this location belongs to (:claude, :opencode, :codex)

Returns:

  • (Symbol)

    the current value of agent



31
32
33
# File 'lib/agent_settings/location.rb', line 31

def agent
  @agent
end

#existsBoolean (readonly)

whether the config file exists at this path

Returns:

  • (Boolean)

    the current value of exists



31
32
33
# File 'lib/agent_settings/location.rb', line 31

def exists
  @exists
end

#noteString? (readonly)

optional note about this location

Returns:

  • (String, nil)

    the current value of note



31
32
33
# File 'lib/agent_settings/location.rb', line 31

def note
  @note
end

#pathString (readonly)

the absolute file path to the config file

Returns:

  • (String)

    the current value of path



31
32
33
# File 'lib/agent_settings/location.rb', line 31

def path
  @path
end

#scopeSymbol (readonly)

the scope of this location (:global, :project, :managed, :system, :env)

Returns:

  • (Symbol)

    the current value of scope



31
32
33
# File 'lib/agent_settings/location.rb', line 31

def scope
  @scope
end

#sourceString (readonly)

where this location comes from ('user', 'system', 'file', 'local')

Returns:

  • (String)

    the current value of source



31
32
33
# File 'lib/agent_settings/location.rb', line 31

def source
  @source
end

Instance Method Details

#active?Boolean

Returns whether this is the currently effective config location.

Returns:

  • (Boolean)

    whether this is the currently effective config location



36
# File 'lib/agent_settings/location.rb', line 36

def active? = active

#exists?Boolean

Returns whether the config file exists at this path.

Returns:

  • (Boolean)

    whether the config file exists at this path



33
# File 'lib/agent_settings/location.rb', line 33

def exists? = exists