Module: Rung::Definition::OperationDSL

Included in:
Operation
Defined in:
lib/rung/definition/operation_dsl.rb

Overview

DSL for calls that can be executed only on the operation level (doesn't work in nested steps).

Instance Method Summary collapse

Instance Method Details

#around(action = nil, &block) ⇒ Object

Defines a callback that is executed around operation call

Examples:

Using action

around Wrapper

Using block

around { Transaction { yield } }

Parameters:

  • action (#call, Symbol) (defaults to: nil)

23
24
25
# File 'lib/rung/definition/operation_dsl.rb', line 23

def around(action = nil, &block)
  around_callbacks.push callback_from_definition(action, &block)
end

#around_callbacksArray<Rung::Definition::Callback>

Returns:


7
8
9
# File 'lib/rung/definition/operation_dsl.rb', line 7

def around_callbacks
  @around_callbacks ||= []
end

#around_each(action = nil, &block) ⇒ Object

Defines a callback that is executed around each step call

Examples:

Using action

around_each Wrapper

Using block

around_each { Transaction { yield } }

Parameters:

  • action (#call, Symbol) (defaults to: nil)

34
35
36
# File 'lib/rung/definition/operation_dsl.rb', line 34

def around_each(action = nil, &block)
  around_each_callbacks.push callback_from_definition(action, &block)
end

#around_each_callbacksArray<Rung::Definition::Callback>

Returns:


12
13
14
# File 'lib/rung/definition/operation_dsl.rb', line 12

def around_each_callbacks
  @around_each_callbacks ||= []
end