Class: LocaliseRails::RequestStoreTranslations

Inherits:
Object
  • Object
show all
Defined in:
lib/localise_rails/request_store_translations.rb

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object



3
4
5
6
# File 'lib/localise_rails/request_store_translations.rb', line 3

def [](key)
  seed_translations if RequestStore.store[:translations].nil?
  RequestStore.store.dig(:translations, key)
end

#[]=(key, value) ⇒ Object



8
9
10
# File 'lib/localise_rails/request_store_translations.rb', line 8

def []=(key, value)
  RequestStore.store[:translations][key] = value
end

#keysObject



12
13
14
15
# File 'lib/localise_rails/request_store_translations.rb', line 12

def keys
  seed_translations if RequestStore.store[:translations].nil?
  RequestStore.store[:translations].keys
end