~ubuntu-branches/ubuntu/vivid/ruby-i18n/vivid

« back to all changes in this revision

Viewing changes to lib/i18n/backend/key_value.rb

  • Committer: Package Import Robot
  • Author(s): Praveen Arimbrathodiyil
  • Date: 2013-06-03 19:20:31 UTC
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: package-import@ubuntu.com-20130603192031-qk11as87x3cotd1n
Tags: upstream-0.6.1
ImportĀ upstreamĀ versionĀ 0.6.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
              raise "Key-value stores cannot handle procs"
74
74
            end
75
75
 
76
 
            @store[key] = ActiveSupport::JSON.encode(value) unless value.is_a?(Symbol)
 
76
            @store[key] = ActiveSupport::JSON.encode([value]) unless value.is_a?(Symbol)
77
77
          end
78
78
        end
79
79
 
90
90
        def lookup(locale, key, scope = [], options = {})
91
91
          key   = normalize_flat_keys(locale, key, scope, options[:separator])
92
92
          value = @store["#{locale}.#{key}"]
93
 
          value = ActiveSupport::JSON.decode(value) if value
 
93
          value = ActiveSupport::JSON.decode(value)[0] if value
94
94
          value.is_a?(Hash) ? value.deep_symbolize_keys : value
95
95
        end
96
96
      end