Module: Alexa::Container::ClassMethods

Defined in:
lib/alexa/container.rb

Instance Method Summary collapse

Instance Method Details

#from_mongo(value) ⇒ Object



37
38
39
40
41
42
43
44
45
# File 'lib/alexa/container.rb', line 37

def from_mongo(value)
  return nil if value.nil?
  return value if value.is_a?(self)

  o = self.new
  o.data = value

  return o
end

#to_mongo(value) ⇒ Object



30
31
32
33
34
35
# File 'lib/alexa/container.rb', line 30

def to_mongo(value)
  return nil if value.nil?
  return value if value.is_a?(Hash)

  value.data
end