Class: BranchDb::MysqlSwitcher

Inherits:
Switcher
  • Object
show all
Includes:
RealDbSwitchersCommon
Defined in:
lib/branch_db/mysql_switcher.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Switcher

branches, #copy_from, create, #create_empty_database, #delete_database, #exists?, #initialize, #switch!, which

Constructor Details

This class inherits a constructor from BranchDb::Switcher

Class Method Details

.can_handle?(config) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/branch_db/mysql_switcher.rb', line 10

def self.can_handle?(config)
  config['adapter'] == 'mysql'
end

Instance Method Details

#currentObject



14
15
16
17
# File 'lib/branch_db/mysql_switcher.rb', line 14

def current
  current_branch = branch_db_exists?(@branch) ? @branch : 'master'
  puts "#{@rails_env}: #{branch_db(current_branch)} (MySQL)"
end