class Atomically::AdapterCheckService

Public Class Methods

new(klass) click to toggle source
# File lib/atomically/adapter_check_service.rb, line 3
def initialize(klass)
  @klass = klass
end

Public Instance Methods

mysql?() click to toggle source
# File lib/atomically/adapter_check_service.rb, line 11
def mysql?
  possible_mysql_klasses.any?{|s| @klass.connection.is_a?(s) }
end
pg?() click to toggle source
# File lib/atomically/adapter_check_service.rb, line 7
def pg?
  possible_pg_klasses.any?{|s| @klass.connection.is_a?(s) }
end

Private Instance Methods

possible_mysql_klasses() click to toggle source
# File lib/atomically/adapter_check_service.rb, line 24
def possible_mysql_klasses
  @possible_mysql_klasses ||= [].tap do |result|
    result << ActiveRecord::ConnectionAdapters::Mysql2Adapter if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter)
    result << ActiveRecord::ConnectionAdapters::MakaraMysql2Adapter if defined?(ActiveRecord::ConnectionAdapters::MakaraMysql2Adapter)
  end
end
possible_pg_klasses() click to toggle source
# File lib/atomically/adapter_check_service.rb, line 17
def possible_pg_klasses
  @possible_pg_klasses ||= [].tap do |result|
    result << ActiveRecord::ConnectionAdapters::PostgreSQLAdapter if defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
    result << ActiveRecord::ConnectionAdapters::MakaraPostgreSQLAdapter if defined?(ActiveRecord::ConnectionAdapters::MakaraPostgreSQLAdapter)
  end
end