Class: Omen::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/omen/config.rb

Overview

Every fact about the app this feature is installed in, so none of its own classes names one. All of them have a default, which is what makes the initializer a host writes optional.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize ⇒ Config

Returns a new instance of Config.



27
28
29
30
31
32
33
34
# File 'lib/omen/config.rb', line 27

def initialize
  @reading_role = :reading
  @narrow_role = 'omen_inquirer'
  @claude_model = 'claude-opus-5'
  @maximum_rows = 100
  @remembered = 5
  @schema_path = 'db/schema.rb'
end

Instance Attribute Details

#api_key ⇒ Object

The key the Anthropic API is reached with. Left unset, the SDK resolves one of its own.



22
23
24
# File 'lib/omen/config.rb', line 22

def api_key
  @api_key
end

#claude_model ⇒ Object

The Claude model a question is asked of.



13
14
15
# File 'lib/omen/config.rb', line 13

def claude_model
  @claude_model
end

#maximum_rows ⇒ Object

How many rows of one answer a page will show.



16
17
18
# File 'lib/omen/config.rb', line 16

def maximum_rows
  @maximum_rows
end

#narrow_role ⇒ Object

The Postgres role a statement runs as, narrower again than the connection's own.



10
11
12
# File 'lib/omen/config.rb', line 10

def narrow_role
  @narrow_role
end

#notes ⇒ String

Returns the host's own notes about its data, which its schema cannot state.

Returns:

  • (String) —

    the host's own notes about its data, which its schema cannot state.



41
# File 'lib/omen/config.rb', line 41

def notes = @notes ? File.read(@notes) : ''

#reading_role ⇒ Object

The Rails connection role a statement is read through. A host has to declare a read-only one: Omen raises rather than falling back to the writing role, which is the point.



7
8
9
# File 'lib/omen/config.rb', line 7

def reading_role
  @reading_role
end

#record_class=(value) ⇒ Object (writeonly)

What a host states as a name or as a path, each of them resolved only when it is wanted.



25
26
27
# File 'lib/omen/config.rb', line 25

def record_class=(value)
  @record_class = value
end

#remembered ⇒ Object

How many turns of a thread travel with the next question.



19
20
21
# File 'lib/omen/config.rb', line 19

def remembered
  @remembered
end

#schema_path=(value) ⇒ Object (writeonly)

What a host states as a name or as a path, each of them resolved only when it is wanted.



25
26
27
# File 'lib/omen/config.rb', line 25

def schema_path=(value)
  @schema_path = value
end

Instance Method Details

#record ⇒ Class

A name rather than the class, since nothing is autoloaded while an initializer runs.

Returns:

  • (Class) —

    the Active Record whose descendants and connection roles this feature uses.



38
# File 'lib/omen/config.rb', line 38

def record = @record_class ? @record_class.constantize : default_record

#schema ⇒ Pathname

Returns the file Rails keeps in step with the database, which Claude is shown.

Returns:

  • (Pathname) —

    the file Rails keeps in step with the database, which Claude is shown.



44
# File 'lib/omen/config.rb', line 44

def schema = Rails.root.join @schema_path