Class: Mobility::Backends::ActiveRecord::PgHash::Coder
- Inherits:
-
Object
- Object
- Mobility::Backends::ActiveRecord::PgHash::Coder
- Defined in:
- lib/mobility/backends/active_record/pg_hash.rb
Class Method Summary collapse
Class Method Details
.dump(obj) ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/mobility/backends/active_record/pg_hash.rb', line 30 def self.dump(obj) if obj.is_a? Hash obj.inject({}) do |translations, (locale, value)| translations[locale] = value if value.present? translations end else raise ArgumentError, "Attribute is supposed to be a Hash, but was a #{obj.class}. -- #{obj.inspect}" end end |
.load(obj) ⇒ Object
41 42 43 |
# File 'lib/mobility/backends/active_record/pg_hash.rb', line 41 def self.load(obj) obj end |