Class: Mobility::Backend::ActiveRecord::HashValued
- Includes:
- Mobility::Backend
- Defined in:
- lib/mobility/backend/active_record/hash_valued.rb
Overview
Internal class used by ActiveRecord backends that store values as a hash.
Defined Under Namespace
Classes: Coder
Instance Attribute Summary
Attributes included from Mobility::Backend
Backend Accessors collapse
-
#read(locale, **options) ⇒ Object
Value of translation.
-
#write(locale, value, **options) ⇒ Object
Updated value.
Instance Method Summary collapse
- #translations ⇒ Object (also: #new_cache)
- #write_to_cache? ⇒ Boolean
Methods included from Mobility::Backend
included, #initialize, method_name
Instance Method Details
#read(locale, **options) ⇒ Object
Returns Value of translation.
14 15 16 |
# File 'lib/mobility/backend/active_record/hash_valued.rb', line 14 def read(locale, **) translations[locale] end |
#translations ⇒ Object Also known as: new_cache
24 25 26 |
# File 'lib/mobility/backend/active_record/hash_valued.rb', line 24 def translations model.read_attribute(attribute) end |
#write(locale, value, **options) ⇒ Object
Returns Updated value.
19 20 21 |
# File 'lib/mobility/backend/active_record/hash_valued.rb', line 19 def write(locale, value, **) translations[locale] = value end |
#write_to_cache? ⇒ Boolean
29 30 31 |
# File 'lib/mobility/backend/active_record/hash_valued.rb', line 29 def write_to_cache? true end |