Sha256: 37264f5a5ee0048effc52ef6ada0add6a2f8d40551960951484250eeda5301c8
Contents?: true
Size: 729 Bytes
Versions: 1
Compression:
Stored size: 729 Bytes
Contents
module ROM module Mongo class Adapter < ROM::Adapter def self.schemes [:mongo] end class Dataset include Charlatan.new(:collection, kind: Moped::Query) def each(&block) collection.find.each(&block) end end def initialize(*args) super @connection = Moped::Session.new(["#{uri.host}:#{uri.port}"]) @connection.use uri.path.gsub('/', '') end def [](name) Dataset.new(connection[name]) end def dataset?(name) connection.collection_names.include?(name.to_s) end def command_namespace Mongo::Commands end ROM::Adapter.register(self) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rom-mongo-0.0.2 | lib/rom/mongo/adapter.rb |