Class: CLAI::Config

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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_keyObject (readonly)

Returns the value of attribute api_key.



15
16
17
# File 'lib/clai/config.rb', line 15

def api_key
  @api_key
end

#modelObject (readonly)

Returns the value of attribute model.



15
16
17
# File 'lib/clai/config.rb', line 15

def model
  @model
end

#personasObject (readonly)

Returns the value of attribute personas.



15
16
17
# File 'lib/clai/config.rb', line 15

def personas
  @personas
end

Class Method Details

.parseObject



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