Class: Desiru::Configuration
- Inherits:
-
Object
- Object
- Desiru::Configuration
- Defined in:
- lib/desiru/configuration.rb
Overview
Global configuration for Desiru Follows singleton pattern for service-oriented design
Instance Attribute Summary collapse
-
#cache_enabled ⇒ Object
Returns the value of attribute cache_enabled.
-
#cache_ttl ⇒ Object
Returns the value of attribute cache_ttl.
-
#default_model ⇒ Object
Returns the value of attribute default_model.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#max_retries ⇒ Object
Returns the value of attribute max_retries.
-
#model_timeout ⇒ Object
Returns the value of attribute model_timeout.
-
#module_registry ⇒ Object
Returns the value of attribute module_registry.
-
#redis_url ⇒ Object
Returns the value of attribute redis_url.
-
#retry_count ⇒ Object
Returns the value of attribute retry_count.
-
#retry_delay ⇒ Object
Returns the value of attribute retry_delay.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/desiru/configuration.rb', line 11 def initialize @default_model = nil @cache_enabled = true @cache_ttl = 3600 # 1 hour @max_retries = 3 @retry_delay = 1 @retry_count = 3 @logger = default_logger @module_registry = Desiru::Registry.instance @model_timeout = 30 @redis_url = nil # Defaults to REDIS_URL env var if not set end |
Instance Attribute Details
#cache_enabled ⇒ Object
Returns the value of attribute cache_enabled.
7 8 9 |
# File 'lib/desiru/configuration.rb', line 7 def cache_enabled @cache_enabled end |
#cache_ttl ⇒ Object
Returns the value of attribute cache_ttl.
7 8 9 |
# File 'lib/desiru/configuration.rb', line 7 def cache_ttl @cache_ttl end |
#default_model ⇒ Object
Returns the value of attribute default_model.
7 8 9 |
# File 'lib/desiru/configuration.rb', line 7 def default_model @default_model end |
#logger ⇒ Object
Returns the value of attribute logger.
7 8 9 |
# File 'lib/desiru/configuration.rb', line 7 def logger @logger end |
#max_retries ⇒ Object
Returns the value of attribute max_retries.
7 8 9 |
# File 'lib/desiru/configuration.rb', line 7 def max_retries @max_retries end |
#model_timeout ⇒ Object
Returns the value of attribute model_timeout.
7 8 9 |
# File 'lib/desiru/configuration.rb', line 7 def model_timeout @model_timeout end |
#module_registry ⇒ Object
Returns the value of attribute module_registry.
7 8 9 |
# File 'lib/desiru/configuration.rb', line 7 def module_registry @module_registry end |
#redis_url ⇒ Object
Returns the value of attribute redis_url.
7 8 9 |
# File 'lib/desiru/configuration.rb', line 7 def redis_url @redis_url end |
#retry_count ⇒ Object
Returns the value of attribute retry_count.
7 8 9 |
# File 'lib/desiru/configuration.rb', line 7 def retry_count @retry_count end |
#retry_delay ⇒ Object
Returns the value of attribute retry_delay.
7 8 9 |
# File 'lib/desiru/configuration.rb', line 7 def retry_delay @retry_delay end |
Instance Method Details
#validate! ⇒ Object
24 25 26 27 |
# File 'lib/desiru/configuration.rb', line 24 def validate! raise ConfigurationError, 'default_model must be set' unless default_model raise ConfigurationError, 'default_model must respond to :complete' unless default_model.respond_to?(:complete) end |