Module: ServiceOperator::Hooks::ClassMethods
- Defined in:
- lib/service_operator/hooks.rb
Instance Method Summary collapse
Instance Method Details
#around(name = nil, &block) ⇒ Object
Examples
class MyOperator
include ServiceOperator::Helpers
around :use_transaction
around do |operator|
puts 'started'
operator.call
puts 'finished'
end
private
def use_transaction(operator)
context.start_time = Time.now
operator.call
context.finish_time = Time.now
end
end
38 39 40 |
# File 'lib/service_operator/hooks.rb', line 38 def around(name=nil, &block) around_hooks << Step.new(name: name, service: nil, args: nil, block: block) end |
#around_hooks ⇒ Object
12 13 14 |
# File 'lib/service_operator/hooks.rb', line 12 def around_hooks @around_hooks ||= [] end |