Sha256: 9cc10c459cc7d4fa4b12aeb809d6361e11a67c22ccb81b220bbba0dca6d4d67d

Contents?: true

Size: 382 Bytes

Versions: 10

Compression:

Stored size: 382 Bytes

Contents

# encoding: UTF-8
module MongoMapper
  module Extensions
    module Binary
      def to_mongo(value)
        if value.instance_of?(::BSON::Binary)
          value
        else
          value.nil? ? nil : ::BSON::Binary.new(value)
        end
      end

      def from_mongo(value)
        value
      end
    end
  end
end

class Binary
  extend MongoMapper::Extensions::Binary
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mongo_mapper-0.15.3 lib/mongo_mapper/extensions/binary.rb
mongo_mapper-0.15.2 lib/mongo_mapper/extensions/binary.rb
mongo_mapper-0.15.1 lib/mongo_mapper/extensions/binary.rb
mongo_mapper-0.15.0 lib/mongo_mapper/extensions/binary.rb
mongo_mapper-0.14.0 lib/mongo_mapper/extensions/binary.rb
mongo_mapper-0.14.0.rc1 lib/mongo_mapper/extensions/binary.rb
mongo_mapper-0.13.1 lib/mongo_mapper/extensions/binary.rb
mongo_mapper-0.13.0 lib/mongo_mapper/extensions/binary.rb
mongo_mapper-0.13.0.beta2 lib/mongo_mapper/extensions/binary.rb
mongo_mapper-0.13.0.beta1 lib/mongo_mapper/extensions/binary.rb