module Mongoid::Extensions::Binary::ClassMethods

def mongoize(object)

Returns:
  • (BSON::Binary | nil) - A Binary representing the object or nil.

Parameters:
  • object (Object) -- The object to Mongoize

Other tags:
    Example: Mongoize the object. -
def mongoize(object)
  return if object.nil?
  case object
  when BSON::Binary then object
  when String, Symbol then BSON::Binary.new(object.to_s)
  end
end