Class: Rooq::ExecutorHooks

Inherits:
Object
  • Object
show all
Defined in:
lib/rooq/executor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(before_execute: nil, after_execute: nil) ⇒ ExecutorHooks

Returns a new instance of ExecutorHooks.



51
52
53
54
55
# File 'lib/rooq/executor.rb', line 51

def initialize(before_execute: nil, after_execute: nil)
  @before_execute = before_execute
  @after_execute = after_execute
  freeze
end

Instance Attribute Details

#after_executeObject (readonly)

Returns the value of attribute after_execute.



49
50
51
# File 'lib/rooq/executor.rb', line 49

def after_execute
  @after_execute
end

#before_executeObject (readonly)

Returns the value of attribute before_execute.



49
50
51
# File 'lib/rooq/executor.rb', line 49

def before_execute
  @before_execute
end

Instance Method Details

#with_after_execute(block) ⇒ Object



61
62
63
# File 'lib/rooq/executor.rb', line 61

def with_after_execute(block)
  ExecutorHooks.new(before_execute: @before_execute, after_execute: block)
end

#with_before_execute(block) ⇒ Object



57
58
59
# File 'lib/rooq/executor.rb', line 57

def with_before_execute(block)
  ExecutorHooks.new(before_execute: block, after_execute: @after_execute)
end