Class: I18n::Backend::RemoteBackend::Loader
- Inherits:
-
Object
- Object
- I18n::Backend::RemoteBackend::Loader
- Defined in:
- lib/i18n/backend/remote_backend/loader.rb
Instance Attribute Summary collapse
-
#locale ⇒ Object
readonly
Returns the value of attribute locale.
-
#yaml ⇒ Object
Returns the value of attribute yaml.
Instance Method Summary collapse
- #fetch_locale ⇒ Object
-
#initialize(locale = default_locale) ⇒ Loader
constructor
A new instance of Loader.
Constructor Details
#initialize(locale = default_locale) ⇒ Loader
Returns a new instance of Loader.
12 13 14 |
# File 'lib/i18n/backend/remote_backend/loader.rb', line 12 def initialize(locale = default_locale) @locale = locale end |
Instance Attribute Details
#locale ⇒ Object (readonly)
Returns the value of attribute locale.
9 10 11 |
# File 'lib/i18n/backend/remote_backend/loader.rb', line 9 def locale @locale end |
#yaml ⇒ Object
Returns the value of attribute yaml.
10 11 12 |
# File 'lib/i18n/backend/remote_backend/loader.rb', line 10 def yaml @yaml end |
Instance Method Details
#fetch_locale ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/i18n/backend/remote_backend/loader.rb', line 16 def fetch_locale raise RemoteBackend::BlankURLException if RemoteBackend.configuration.http_url.nil? begin yaml = YAML.safe_load(fetch_remote_file) Utils.deep_symbolize_keys(yaml) if yaml.instance_of?(Hash) rescue StandardError => e RemoteBackend.logger.error "Error occured while reading remote locale : #{RemoteBackend.configuration.http_url}/#{locale} error: " + e.inspect nil end end |