Class: Ridgepole::ExecuteExpander

Inherits:
Object
  • Object
show all
Defined in:
lib/ridgepole/execute_expander.rb

Defined Under Namespace

Modules: ConnectionAdapterExt Classes: Stub

Class Method Summary collapse

Class Method Details

.expand_execute(connection) ⇒ Object



88
89
90
91
92
93
94
# File 'lib/ridgepole/execute_expander.rb', line 88

def expand_execute(connection)
  return if connection.is_a?(ConnectionAdapterExt)

  connection.class_eval do
    prepend ConnectionAdapterExt
  end
end

.with_alter_extra(extra) ⇒ Object



79
80
81
82
83
84
85
86
# File 'lib/ridgepole/execute_expander.rb', line 79

def with_alter_extra(extra)
  begin
    self.alter_extra = extra
    yield
  ensure
    self.alter_extra = nil
  end
end

.with_script(script, logger) ⇒ Object



68
69
70
71
72
73
74
75
76
77
# File 'lib/ridgepole/execute_expander.rb', line 68

def with_script(script, logger)
  begin
    self.use_script = true
    self.sql_executer = Ridgepole::ExternalSqlExecuter.new(script, logger)
    yield
  ensure
    self.use_script = false
    self.sql_executer = nil
  end
end

.without_operation(callback = nil) ⇒ Object



57
58
59
60
61
62
63
64
65
66
# File 'lib/ridgepole/execute_expander.rb', line 57

def without_operation(callback = nil)
  begin
    self.noop = true
    self.callback = callback
    yield
  ensure
    self.noop = false
    self.callback = nil
  end
end