Class: Soka::Rails::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/soka/rails/configuration.rb

Overview

Main configuration class for Soka Rails settings

Defined Under Namespace

Classes: AIConfig, PerformanceConfig

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



9
10
11
12
13
14
15
16
17
# File 'lib/soka/rails/configuration.rb', line 9

def initialize
  # Use ENV.fetch to set default values
  @ai_provider = ENV.fetch('SOKA_PROVIDER', :gemini).to_sym
  @ai_model = ENV.fetch('SOKA_MODEL', 'gemini-2.5-flash-lite')
  @ai_api_key = ENV.fetch('SOKA_API_KEY', nil)

  # Performance settings
  @max_iterations = defined?(::Rails) && ::Rails.env.production? ? 10 : 5
end

Instance Attribute Details

#ai_api_keyObject

Returns the value of attribute ai_api_key.



7
8
9
# File 'lib/soka/rails/configuration.rb', line 7

def ai_api_key
  @ai_api_key
end

#ai_modelObject

Returns the value of attribute ai_model.



7
8
9
# File 'lib/soka/rails/configuration.rb', line 7

def ai_model
  @ai_model
end

#ai_providerObject

Returns the value of attribute ai_provider.



7
8
9
# File 'lib/soka/rails/configuration.rb', line 7

def ai_provider
  @ai_provider
end

#max_iterationsObject

Returns the value of attribute max_iterations.



7
8
9
# File 'lib/soka/rails/configuration.rb', line 7

def max_iterations
  @max_iterations
end

Instance Method Details

#ai {|AIConfig.new(self)| ... } ⇒ Object

DSL configuration methods

Yields:



20
21
22
# File 'lib/soka/rails/configuration.rb', line 20

def ai
  yield(AIConfig.new(self)) if block_given?
end

#performance {|PerformanceConfig.new(self)| ... } ⇒ Object

Yields:



24
25
26
# File 'lib/soka/rails/configuration.rb', line 24

def performance
  yield(PerformanceConfig.new(self)) if block_given?
end