Sha256: f501d3b0218202de927c927a8bd1f91d1437a2c1836fb6d1d4745ce273373f12

Contents?: true

Size: 504 Bytes

Versions: 31

Compression:

Stored size: 504 Bytes

Contents

require 'mongo'

module Volt
  class DataStore
    class MongoDriver
      def self.fetch
        if Volt.config.db_uri.present?
          @@mongo_db ||= Mongo::MongoClient.from_uri(Volt.config.db_uri)
          @@db ||= @@mongo_db.db(Volt.config.db_uri.split('/').last || Volt.config.db_name)
        else
          @@mongo_db ||= Mongo::MongoClient.new(Volt.config.db_host, Volt.config.db_path)
          @@db ||= @@mongo_db.db(Volt.config.db_name)
        end
        @@db
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
volt-0.9.1.pre4 lib/volt/data_stores/mongo_driver.rb
volt-0.9.1.pre3 lib/volt/data_stores/mongo_driver.rb
volt-0.9.1.pre2 lib/volt/data_stores/mongo_driver.rb
volt-0.9.1.pre1 lib/volt/data_stores/mongo_driver.rb
volt-0.9.0 lib/volt/data_stores/mongo_driver.rb
volt-0.9.0.pre7 lib/volt/data_stores/mongo_driver.rb
volt-0.9.0.pre6 lib/volt/data_stores/mongo_driver.rb
volt-0.9.0.pre5 lib/volt/data_stores/mongo_driver.rb
volt-0.9.0.pre4 lib/volt/data_stores/mongo_driver.rb
volt-0.9.0.pre3 lib/volt/data_stores/mongo_driver.rb
volt-0.9.0.pre2 lib/volt/data_stores/mongo_driver.rb
volt-0.9.0.pre1 lib/volt/data_stores/mongo_driver.rb
volt-0.8.27.beta9 lib/volt/data_stores/mongo_driver.rb
volt-0.8.27.beta8 lib/volt/data_stores/mongo_driver.rb
volt-0.8.27.beta7 lib/volt/data_stores/mongo_driver.rb
volt-0.8.27.beta6 lib/volt/data_stores/mongo_driver.rb
volt-0.8.27.beta5 lib/volt/data_stores/mongo_driver.rb
volt-0.8.27.beta4 lib/volt/data_stores/mongo_driver.rb
volt-0.8.27.beta3 lib/volt/data_stores/mongo_driver.rb
volt-0.8.27.beta2 lib/volt/data_stores/mongo_driver.rb