Class: Soka::Configuration

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

Overview

Global configuration for Soka framework

Defined Under Namespace

Classes: AIConfig, PerformanceConfig

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



27
28
29
30
31
# File 'lib/soka/configuration.rb', line 27

def initialize
  @ai = AIConfig.new
  @performance = PerformanceConfig.new
  @tools = []
end

Instance Attribute Details

#toolsObject

Returns the value of attribute tools.



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

def tools
  @tools
end

Instance Method Details

#ai {|AIConfig| ... } ⇒ AIConfig

Access or configure AI settings

Yields:

  • (AIConfig)

    Configuration block for AI settings

Returns:



48
49
50
# File 'lib/soka/configuration.rb', line 48

def ai(&)
  block_given? ? configure(:ai, &) : @ai
end

#configure(section) { ... } ⇒ Object

Configure a specific section

Parameters:

  • section (Symbol)

    The section to configure (:ai, :performance, :logging)

Yields:

  • Configuration block for the section

Returns:

  • (Object)

    The configuration section



37
38
39
40
41
# File 'lib/soka/configuration.rb', line 37

def configure(section)
  config_object = instance_variable_get("@#{section}")
  yield(config_object) if block_given? && config_object
  config_object
end

#performance {|PerformanceConfig| ... } ⇒ PerformanceConfig

Access or configure performance settings

Yields:

Returns:



55
56
57
# File 'lib/soka/configuration.rb', line 55

def performance(&)
  block_given? ? configure(:performance, &) : @performance
end