Class: Otto::Locale::Config
- Inherits:
-
Object
- Object
- Otto::Locale::Config
- Includes:
- Core::Freezable
- Defined in:
- lib/otto/locale/config.rb
Overview
Locale configuration for Otto applications
This class manages locale-related settings including available locales and default locale selection.
Instance Attribute Summary collapse
-
#available_locales ⇒ Object
Returns the value of attribute available_locales.
-
#default_locale ⇒ Object
Returns the value of attribute default_locale.
-
#fallback_locale ⇒ Object
Returns the value of attribute fallback_locale.
Instance Method Summary collapse
-
#configured? ⇒ Boolean
Check if locale configuration is present.
-
#initialize(available_locales: nil, default_locale: nil, fallback_locale: nil) ⇒ Config
constructor
Initialize locale configuration.
-
#to_h ⇒ Hash
Convert to hash for compatibility with existing code.
Methods included from Core::Freezable
Constructor Details
#initialize(available_locales: nil, default_locale: nil, fallback_locale: nil) ⇒ Config
Initialize locale configuration
34 35 36 37 38 |
# File 'lib/otto/locale/config.rb', line 34 def initialize(available_locales: nil, default_locale: nil, fallback_locale: nil) @available_locales = available_locales @default_locale = default_locale @fallback_locale = fallback_locale end |
Instance Attribute Details
#available_locales ⇒ Object
Returns the value of attribute available_locales.
27 28 29 |
# File 'lib/otto/locale/config.rb', line 27 def available_locales @available_locales end |
#default_locale ⇒ Object
Returns the value of attribute default_locale.
27 28 29 |
# File 'lib/otto/locale/config.rb', line 27 def default_locale @default_locale end |
#fallback_locale ⇒ Object
Returns the value of attribute fallback_locale.
27 28 29 |
# File 'lib/otto/locale/config.rb', line 27 def fallback_locale @fallback_locale end |
Instance Method Details
#configured? ⇒ Boolean
Check if locale configuration is present
54 55 56 |
# File 'lib/otto/locale/config.rb', line 54 def configured? !@available_locales.nil? || !@default_locale.nil? end |
#to_h ⇒ Hash
Convert to hash for compatibility with existing code
43 44 45 46 47 48 49 |
# File 'lib/otto/locale/config.rb', line 43 def to_h { available_locales: @available_locales, default_locale: @default_locale, fallback_locale: @fallback_locale, }.compact end |