Module: Wgit::Database

Defined in:
lib/wgit/database/database.rb,
lib/wgit/database/database_adapter.rb,
lib/wgit/database/adapters/mongo_db.rb,
lib/wgit/database/adapters/in_memory.rb

Overview

Module providing a Database connection and CRUD operations for the Url and Document collections that form the Wgit persistence layer.

Defined Under Namespace

Classes: DatabaseAdapter, InMemory, MongoDB

Constant Summary collapse

DEFAULT_ADAPTER_CLASS =

The default Database adapter class used by Wgit.

Wgit::Database::MongoDB

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.adapter_classObject

The Database adapter class to use with Wgit. The adapter you supply should be a subclass of Wgit::Database::DatabaseAdapter and should implement the methods within it, in order to work with Wgit.



20
21
22
# File 'lib/wgit/database/database.rb', line 20

def adapter_class
  @adapter_class
end

Class Method Details

.new(connection_string = nil) ⇒ Object

Initializes a DatabaseAdapter instance. Is an alias for: Wgit::Database.adapter_class.new(connection_string)

Parameters:

  • connection_string (String) (defaults to: nil)

    The connection string needed to connect to the database.

Raises:

  • (StandardError)

    If a connection string isn't provided, either as a parameter or via the environment.



30
31
32
# File 'lib/wgit/database/database.rb', line 30

def self.new(connection_string = nil)
  Wgit::Database.adapter_class.new(connection_string)
end