module Mobility::Backends::HashValued
Defines read and write methods that access the value at a key with value locale
on a translations
hash.
Public Class Methods
included(backend_class)
click to toggle source
# File lib/mobility/backends/hash_valued.rb, line 33 def self.included(backend_class) backend_class.extend ClassMethods backend_class.option_reader :column_affix end
Public Instance Methods
each_locale() { |l| ... }
click to toggle source
@!macro backend_iterator
# File lib/mobility/backends/hash_valued.rb, line 29 def each_locale translations.each { |l, _| yield l } end
read(locale, _options = nil)
click to toggle source
@!group Backend
Accessors
@!macro backend_reader
# File lib/mobility/backends/hash_valued.rb, line 18 def read(locale, _options = nil) translations[locale] end
write(locale, value, _options = nil)
click to toggle source
@!macro backend_writer
# File lib/mobility/backends/hash_valued.rb, line 23 def write(locale, value, _options = nil) translations[locale] = value end
Private Instance Methods
column_name()
click to toggle source
# File lib/mobility/backends/hash_valued.rb, line 50 def column_name @column_name ||= (column_affix % attribute) end