Sha256: aa6b9810920ab2b3ab784369d98aaa370be50d1d23d0484332b2bfccf44695a4

Contents?: true

Size: 375 Bytes

Versions: 71

Compression:

Stored size: 375 Bytes

Contents

# encoding: UTF-8
module MongoMapper
  module Extensions
    module Binary
      def to_mongo(value)
        if value.is_a?(::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

71 entries across 71 versions & 9 rubygems

Version Path
mongo_mapper-0.12.0 lib/mongo_mapper/extensions/binary.rb
lookout-mongo_mapper-0.11.3 lib/mongo_mapper/extensions/binary.rb
mongo_mapper-0.11.2 lib/mongo_mapper/extensions/binary.rb
jamieorc-mongo_mapper-0.11.1.1 lib/mongo_mapper/extensions/binary.rb
mongo_mapper-0.11.1 lib/mongo_mapper/extensions/binary.rb
mongo_mapper-0.11.0 lib/mongo_mapper/extensions/binary.rb
mongo_mapper-0.10.1 lib/mongo_mapper/extensions/binary.rb
mongo_mapper-0.10.0 lib/mongo_mapper/extensions/binary.rb
mongo_mapper-0.9.2 lib/mongo_mapper/extensions/binary.rb
jonbell-mongo_mapper-0.8.6 lib/mongo_mapper/extensions/binary.rb
mongo_mapper-0.9.1 lib/mongo_mapper/extensions/binary.rb
mongo_mapper-0.9.0 lib/mongo_mapper/extensions/binary.rb
ign-mongo_mapper-0.8.6.2 lib/mongo_mapper/extensions/binary.rb
ign-mongo_mapper-0.8.6.1 lib/mongo_mapper/extensions/binary.rb
ssherman-mongo_mapper-0.8.6 lib/mongo_mapper/extensions/binary.rb
mongo_mapper-0.8.6 lib/mongo_mapper/extensions/binary.rb
mongo_mapper-0.8.5 lib/mongo_mapper/extensions/binary.rb
honkster-mongo_mapper-0.8.4 lib/mongo_mapper/extensions/binary.rb
mongo_mapper-0.8.4 lib/mongo_mapper/extensions/binary.rb
mongo_mapper-unstable-2010.08.19 lib/mongo_mapper/extensions/binary.rb