Class: DatabaseConsistency::Databases::Factory

Inherits:
Object
  • Object
show all
Defined in:
lib/database_consistency/databases/factory.rb

Overview

Factory for database adapters

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(adapter) ⇒ Factory

Returns a new instance of Factory.

Parameters:

  • adapter (String)


10
11
12
# File 'lib/database_consistency/databases/factory.rb', line 10

def initialize(adapter)
  @adapter = adapter
end

Instance Attribute Details

#adapterObject (readonly)

Returns the value of attribute adapter.



7
8
9
# File 'lib/database_consistency/databases/factory.rb', line 7

def adapter
  @adapter
end

Instance Method Details

#type(type) ⇒ DatabaseConsistency::Databases::Types::Base



15
16
17
# File 'lib/database_consistency/databases/factory.rb', line 15

def type(type)
  sqlite? ? Types::Sqlite.new(type) : Types::Base.new(type)
end