Class: Soka::Configuration
- Inherits:
-
Object
- Object
- Soka::Configuration
- Defined in:
- lib/soka/configuration.rb
Overview
Global configuration for Soka framework
Defined Under Namespace
Classes: AIConfig, PerformanceConfig
Instance Attribute Summary collapse
-
#tools ⇒ Object
Returns the value of attribute tools.
Instance Method Summary collapse
-
#ai {|AIConfig| ... } ⇒ AIConfig
Access or configure AI settings.
-
#configure(section) { ... } ⇒ Object
Configure a specific section.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#performance {|PerformanceConfig| ... } ⇒ PerformanceConfig
Access or configure performance settings.
Constructor Details
#initialize ⇒ Configuration
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
#tools ⇒ Object
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
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
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
55 56 57 |
# File 'lib/soka/configuration.rb', line 55 def performance(&) block_given? ? configure(:performance, &) : @performance end |