Class: Mobility::Backend::Sequel::HashValued
- Includes:
- Mobility::Backend
- Defined in:
- lib/mobility/backend/sequel/hash_valued.rb
Overview
Internal class used by Sequel backends that store values as a hash.
Instance Attribute Summary
Attributes included from Mobility::Backend
Cache Methods collapse
- #translations ⇒ Object (also: #new_cache)
- #write_to_cache? ⇒ Boolean
Instance Method Summary collapse
-
#read(locale, **options) ⇒ Object
Value of translation.
-
#write(locale, value, **options) ⇒ Object
Updated value.
Methods included from Mobility::Backend
included, #initialize, method_name
Instance Method Details
#read(locale, **options) ⇒ Object
Returns Value of translation.
12 13 14 |
# File 'lib/mobility/backend/sequel/hash_valued.rb', line 12 def read(locale, **) translations[locale.to_s] end |
#translations ⇒ Object Also known as: new_cache
22 23 24 |
# File 'lib/mobility/backend/sequel/hash_valued.rb', line 22 def translations model.send("#{attribute}_before_mobility") end |
#write(locale, value, **options) ⇒ Object
Returns Updated value.
17 18 19 |
# File 'lib/mobility/backend/sequel/hash_valued.rb', line 17 def write(locale, value, **) translations[locale.to_s] = value end |
#write_to_cache? ⇒ Boolean
28 29 30 |
# File 'lib/mobility/backend/sequel/hash_valued.rb', line 28 def write_to_cache? true end |