class Mobility::Backends::Hash

Backend which stores translations in an in-memory hash.

Public Instance Methods

each_locale() { |l| ... } click to toggle source

@!macro backend_iterator

# File lib/mobility/backends/hash.rb, line 26
def each_locale
  translations.each { |l, _| yield l }
end
read(locale, _ = {}) click to toggle source

@!group Backend Accessors @!macro backend_reader @return [Object]

# File lib/mobility/backends/hash.rb, line 14
def read(locale, _ = {})
  translations[locale]
end
write(locale, value, _ = {}) click to toggle source

@!macro backend_writer @return [Object]

# File lib/mobility/backends/hash.rb, line 20
def write(locale, value, _ = {})
  translations[locale] = value
end

Private Instance Methods

translations() click to toggle source
# File lib/mobility/backends/hash.rb, line 32
def translations
  @translations ||= {}
end