Class: Binary

Inherits:
Object show all
Defined in:
lib/mongo_mapper/extensions.rb

Class Method Summary collapse

Class Method Details

.from_mongo(value) ⇒ Object



22
23
24
# File 'lib/mongo_mapper/extensions.rb', line 22

def self.from_mongo(value)
  value
end

.to_mongo(value) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/mongo_mapper/extensions.rb', line 14

def self.to_mongo(value)
  if value.is_a?(BSON::Binary)
    value
  else
    value.nil? ? nil : BSON::Binary.new(value)
  end
end