Class: MySQLNoIo::Wraps::DeactivatedSlave

Inherits:
Object
  • Object
show all
Defined in:
lib/mysqlnoio/wraps/deactivated_slave.rb

Overview

Stops the database slave entirely for your command

Instance Method Summary collapse

Constructor Details

#initialize(mysql) ⇒ DeactivatedSlave

Returns a new instance of DeactivatedSlave.



5
6
7
# File 'lib/mysqlnoio/wraps/deactivated_slave.rb', line 5

def initialize mysql
  @mysql = mysql
end

Instance Method Details

#execute(&block) ⇒ Object



9
10
11
12
13
14
# File 'lib/mysqlnoio/wraps/deactivated_slave.rb', line 9

def execute &block
  @mysql.query('STOP SLAVE;')
  yield
ensure
  @mysql.query('START SLAVE;')
end