Module: Mongoid::Extensions::Object::Conversions::ClassMethods

Defined in:
lib/mongoid/extensions/object/conversions.rb

Instance Method Summary collapse

Instance Method Details

#get(value) ⇒ Object



26
27
28
# File 'lib/mongoid/extensions/object/conversions.rb', line 26

def get(value)
  value ? self.new(value) : value
end

#set(value) ⇒ Object



22
23
24
# File 'lib/mongoid/extensions/object/conversions.rb', line 22

def set(value)
  value.respond_to?(:attributes) ? value.attributes : value
end