Module: RUUID::Mongoid::Extensions::UUID::ClassMethods
- Defined in:
- lib/ruuid/mongoid/extensions/uuid.rb
Instance Method Summary collapse
-
#demongoize(object) ⇒ RUUID::UUID
Convert the object from its Mongo-friendly Ruby type to this type.
-
#mongoize(object) ⇒ BSON::Binary
(also: #evolve)
Turn the object from the Ruby type we deal with to a Mongo-friendly type.
Instance Method Details
#demongoize(object) ⇒ RUUID::UUID
Convert the object from its Mongo-friendly Ruby type to this type.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ruuid/mongoid/extensions/uuid.rb', line 22 def demongoize(object) case object when ::BSON::Binary new(object.data) when ::String parse(object) else object end end |
#mongoize(object) ⇒ BSON::Binary Also known as: evolve
Turn the object from the Ruby type we deal with to a Mongo-friendly type.
41 42 43 |
# File 'lib/ruuid/mongoid/extensions/uuid.rb', line 41 def mongoize(object) object and object.mongoize end |