module RUUID::Mongoid::Extensions::UUID::ClassMethods
Public Instance Methods
demongoize(object)
click to toggle source
Convert the object from its Mongo-friendly Ruby type to this type.
@param [BSON::Binary] object
The object to demongoize.
@return [RUUID::UUID]
The demongoized UUID.
# File lib/ruuid/mongoid/extensions/uuid.rb, line 24 def demongoize(object) case object when BSON::Binary new(object.data) when ::String parse(object) else object end end
mongoize(object)
click to toggle source
Turn the object from the Ruby type we deal with to a Mongo-friendly type.
@param [RUUID::UUID] object
The object to mongoize.
@return [BSON::Binary]
The mongoized object.
# File lib/ruuid/mongoid/extensions/uuid.rb, line 43 def mongoize(object) return object if object.nil? parse(object).mongoize rescue object.mongoize end
Also aliased as: evolve