Class: Mutx::Database::MongoConnection

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/mutx/database/mongo_connection.rb

Instance Method Summary collapse

Instance Method Details

#client(**args) ⇒ Object



10
11
12
13
14
# File 'lib/mutx/database/mongo_connection.rb', line 10

def client(**args)
  mutex.synchronize {
	  @client ||= connect_to_database(args)
  }
end

#closeObject



20
21
22
23
24
25
# File 'lib/mutx/database/mongo_connection.rb', line 20

def close
  mutex.synchronize {
    @client.close if @client
    @client = nil
  }
end

#dbObject



16
17
18
# File 'lib/mutx/database/mongo_connection.rb', line 16

def db
	client.database
end