Class: BSON::DBRef
- Inherits:
-
Object
- Object
- BSON::DBRef
- Defined in:
- lib/mongo_odm/core_ext/conversions.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.type_cast(value) ⇒ Object
31 32 33 34 35 |
# File 'lib/mongo_odm/core_ext/conversions.rb', line 31 def self.type_cast(value) return value if value.is_a?(BSON::DBRef) return value.to_dbref if value.respond_to?(:to_dbref) nil end |
Instance Method Details
#dereference ⇒ Object
41 42 43 |
# File 'lib/mongo_odm/core_ext/conversions.rb', line 41 def dereference MongoODM.instanciate(MongoODM.database.dereference(self)) end |
#eql?(other) ⇒ Boolean Also known as: ==
49 50 51 |
# File 'lib/mongo_odm/core_ext/conversions.rb', line 49 def eql?(other) to_hash == other.to_hash end |
#inspect ⇒ Object
45 46 47 |
# File 'lib/mongo_odm/core_ext/conversions.rb', line 45 def inspect "BSON::DBRef(namespace:\"#{namespace}\", id: \"#{object_id}\")" end |
#to_mongo ⇒ Object
37 38 39 |
# File 'lib/mongo_odm/core_ext/conversions.rb', line 37 def to_mongo self end |