Class: I18nUno::Configuration
- Inherits:
-
Object
- Object
- I18nUno::Configuration
- Defined in:
- lib/i18n_uno/configuration.rb
Instance Attribute Summary collapse
-
#available_locales ⇒ Object
Returns the value of attribute available_locales.
-
#default_locale ⇒ Object
Returns the value of attribute default_locale.
-
#load_path ⇒ Object
Returns the value of attribute load_path.
-
#open_ai_key ⇒ Object
Returns the value of attribute open_ai_key.
-
#open_ai_model ⇒ Object
Returns the value of attribute open_ai_model.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 10 11 12 13 14 15 |
# File 'lib/i18n_uno/configuration.rb', line 7 def initialize raise ConfigurationError, 'Rails must be present to use I18nUno' unless defined?(Rails) @load_path = ::File.join(Rails.root, 'config', 'locales') @open_ai_model = 'gpt-4-0613' @open_ai_key = nil @default_locale = nil @available_locales = nil end |
Instance Attribute Details
#available_locales ⇒ Object
Returns the value of attribute available_locales.
5 6 7 |
# File 'lib/i18n_uno/configuration.rb', line 5 def available_locales @available_locales end |
#default_locale ⇒ Object
Returns the value of attribute default_locale.
5 6 7 |
# File 'lib/i18n_uno/configuration.rb', line 5 def default_locale @default_locale end |
#load_path ⇒ Object
Returns the value of attribute load_path.
5 6 7 |
# File 'lib/i18n_uno/configuration.rb', line 5 def load_path @load_path end |
#open_ai_key ⇒ Object
Returns the value of attribute open_ai_key.
5 6 7 |
# File 'lib/i18n_uno/configuration.rb', line 5 def open_ai_key @open_ai_key end |
#open_ai_model ⇒ Object
Returns the value of attribute open_ai_model.
5 6 7 |
# File 'lib/i18n_uno/configuration.rb', line 5 def open_ai_model @open_ai_model end |
Instance Method Details
#validate! ⇒ Object
17 18 19 20 21 |
# File 'lib/i18n_uno/configuration.rb', line 17 def validate! raise ConfigurationError, 'open_ai_key must be set for API operations' unless open_ai_key raise ConfigurationError, 'available_locales must be set' unless available_locales raise ConfigurationError, 'default_locale must be included in available_locales' if available_locales && !available_locales.include?(default_locale) end |