Class: Mobility::Backends::ActiveRecord::PgHash::Coder

Inherits:
Object
  • Object
show all
Defined in:
lib/mobility/backends/active_record/pg_hash.rb

Class Method Summary collapse

Class Method Details

.dump(obj) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/mobility/backends/active_record/pg_hash.rb', line 32

def self.dump(obj)
  if obj.is_a? ::Hash
    obj.inject({}) do |translations, (locale, value)|
      translations[locale] = value unless value.nil?
      translations
    end
  else
    raise ArgumentError, "Attribute is supposed to be a Hash, but was a #{obj.class}. -- #{obj.inspect}"
  end
end

.load(obj) ⇒ Object



43
44
45
# File 'lib/mobility/backends/active_record/pg_hash.rb', line 43

def self.load(obj)
  obj
end