Class: WithAdvisoryLock::DatabaseAdapterSupport

Inherits:
Object
  • Object
show all
Defined in:
lib/with_advisory_lock/database_adapter_support.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ DatabaseAdapterSupport

Returns a new instance of DatabaseAdapterSupport.


3
4
5
# File 'lib/with_advisory_lock/database_adapter_support.rb', line 3

def initialize(connection)
  @sym_name = connection.adapter_name.downcase.to_sym
end

Instance Method Details

#mysql?Boolean

Returns:

  • (Boolean)

7
8
9
# File 'lib/with_advisory_lock/database_adapter_support.rb', line 7

def mysql?
  [:mysql, :mysql2].include? @sym_name
end

#postgresql?Boolean

Returns:

  • (Boolean)

11
12
13
# File 'lib/with_advisory_lock/database_adapter_support.rb', line 11

def postgresql?
  [:postgresql, :empostgresql, :postgis].include? @sym_name
end

#sqlite?Boolean

Returns:

  • (Boolean)

15
16
17
# File 'lib/with_advisory_lock/database_adapter_support.rb', line 15

def sqlite?
  :sqlite3 == @sym_name
end