Method: MongoMapper::Plugins::Keys::Key#get

Defined in:
lib/mongo_mapper/plugins/keys.rb

#get(value) ⇒ Object



318
319
320
321
322
323
324
325
326
327
328
# File 'lib/mongo_mapper/plugins/keys.rb', line 318

def get(value)
  if value.nil? && !default_value.nil?
    if default_value.respond_to?(:call)
      return default_value.call
    else
      return default_value
    end
  end

  type.from_mongo(value)
end