Class: Omen::Config
- Inherits:
-
Object
- Object
- Omen::Config
- 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
-
#api_key ⇒ Object
The key the Anthropic API is reached with.
-
#claude_model ⇒ Object
The Claude model a question is asked of.
-
#maximum_rows ⇒ Object
How many rows of one answer a page will show.
-
#narrow_role ⇒ Object
The Postgres role a statement runs as, narrower again than the connection's own.
-
#notes ⇒ String
The host's own notes about its data, which its schema cannot state.
-
#reading_role ⇒ Object
The Rails connection role a statement is read through.
-
#record_class ⇒ Object
writeonly
What a host states as a name or as a path, each of them resolved only when it is wanted.
-
#schema_path ⇒ Object
writeonly
What a host states as a name or as a path, each of them resolved only when it is wanted.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
-
#record ⇒ Class
A name rather than the class, since nothing is autoloaded while an initializer runs.
-
#schema ⇒ Pathname
The file Rails keeps in step with the database, which Claude is shown.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
24 25 26 27 28 29 30 |
# File 'lib/omen/config.rb', line 24 def initialize @reading_role = :reading @narrow_role = 'omen_inquirer' @claude_model = 'claude-opus-5' @maximum_rows = 100 @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.
19 20 21 |
# File 'lib/omen/config.rb', line 19 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.
37 |
# File 'lib/omen/config.rb', line 37 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.
22 23 24 |
# File 'lib/omen/config.rb', line 22 def record_class=(value) @record_class = value 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.
22 23 24 |
# File 'lib/omen/config.rb', line 22 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.
34 |
# File 'lib/omen/config.rb', line 34 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.
40 |
# File 'lib/omen/config.rb', line 40 def schema = Rails.root.join @schema_path |