Class: CLAI::Config
- Inherits:
-
Object
- Object
- CLAI::Config
- Defined in:
- lib/clai/config.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#personas ⇒ Object
readonly
Returns the value of attribute personas.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(api_key:, model:, personas:) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(api_key:, model:, personas:) ⇒ Config
Returns a new instance of Config.
17 18 19 20 21 |
# File 'lib/clai/config.rb', line 17 def initialize(api_key:, model:, personas:) @api_key = api_key @model = model @personas = personas end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
15 16 17 |
# File 'lib/clai/config.rb', line 15 def api_key @api_key end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
15 16 17 |
# File 'lib/clai/config.rb', line 15 def model @model end |
#personas ⇒ Object (readonly)
Returns the value of attribute personas.
15 16 17 |
# File 'lib/clai/config.rb', line 15 def personas @personas end |
Class Method Details
.parse ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/clai/config.rb', line 3 def self.parse config = YAML.safe_load_file(CLAI.config_file_path) new( api_key: config["api_key"], model: config["model"], personas: config["personas"] ) rescue Errno::ENOENT puts S.(:no_clai_yml) exit(false) end |