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, options) ⇒ Object



123
124
125
126
127
128
129
130
131
# File 'lib/ridgepole/execute_expander.rb', line 123

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

  self.options = options

  connection.class_eval do
    prepend ConnectionAdapterExt
  end
end

.with_alter_extra(extra) ⇒ Object



116
117
118
119
120
121
# File 'lib/ridgepole/execute_expander.rb', line 116

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

.with_script(script, logger) ⇒ Object



107
108
109
110
111
112
113
114
# File 'lib/ridgepole/execute_expander.rb', line 107

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

.without_operation(callback = nil) ⇒ Object



98
99
100
101
102
103
104
105
# File 'lib/ridgepole/execute_expander.rb', line 98

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