Methods
A
L
N
S
Included Modules
Attributes
[RW] store
Class Public methods
new(store, subtrees=true)
# File activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/backend/key_value.rb, line 57
def initialize(store, subtrees=true)
  @store, @subtrees = store, subtrees
end
Instance Public methods
available_locales()
# File activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/backend/key_value.rb, line 80
def available_locales
  locales = @store.keys.map { |k| k =~ /\./; $` }
  locales.uniq!
  locales.compact!
  locales.map! { |k| k.to_sym }
  locales
end
store_translations(locale, data, options = {})
# File activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/backend/key_value.rb, line 61
def store_translations(locale, data, options = {})
  escape = options.fetch(:escape, true)
  flatten_translations(locale, data, escape, @subtrees).each do |key, value|
    key = "#{locale}.#{key}"
    case value
    when Hash
      if @subtrees && (old_value = @store[key])
        old_value = ActiveSupport::JSON.decode(old_value)
        value = old_value.deep_symbolize_keys.deep_merge!(value) if old_value.is_a?(Hash)
      end
    when Proc
      raise "Key-value stores cannot handle procs"
    end
    @store[key] = ActiveSupport::JSON.encode(value) unless value.is_a?(Symbol)
  end
end
Instance Protected methods
lookup(locale, key, scope = [], options = {})
# File activesupport/lib/active_support/vendor/i18n-0.4.1/i18n/backend/key_value.rb, line 90
def lookup(locale, key, scope = [], options = {})
  key   = normalize_flat_keys(locale, key, scope, options[:separator])
  value = @store["#{locale}.#{key}"]
  value = ActiveSupport::JSON.decode(value) if value
  value.is_a?(Hash) ? value.deep_symbolize_keys : value
end