Sha256: 0a518bf9ba8e7c5938951a5759362cd6a76608fcf18cbdef27b273d68c7a2772

Contents?: true

Size: 603 Bytes

Versions: 6

Compression:

Stored size: 603 Bytes

Contents

module Mobility
  module Backends
=begin

Defines read and write methods that access the value at a key with value
+locale+ on a +translations+ hash.

=end
    module HashValued
      # @!group Backend Accessors
      #
      # @!macro backend_reader
      def read(locale, _options = nil)
        translations[locale]
      end

      # @!macro backend_writer
      def write(locale, value, _options = nil)
        translations[locale] = value
      end
      # @!endgroup

      # @!macro backend_iterator
      def each_locale
        translations.each { |l, _| yield l }
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mobility-0.5.1 lib/mobility/backends/hash_valued.rb
mobility-0.5.0 lib/mobility/backends/hash_valued.rb
mobility-0.4.3 lib/mobility/backends/hash_valued.rb
mobility-0.4.2 lib/mobility/backends/hash_valued.rb
mobility-0.4.1 lib/mobility/backends/hash_valued.rb
mobility-0.4.0 lib/mobility/backends/hash_valued.rb