Class: MongoMapper::Types::Binary

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

Class Method Summary collapse

Class Method Details

.from_mongo(value) ⇒ Object



12
13
14
# File 'lib/mongo_mapper/types.rb', line 12

def self.from_mongo(value)
  value
end

.to_mongo(value) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/mongo_mapper/types.rb', line 4

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