Module: Lavin::Worker::ClassMethods

Defined in:
lib/lavin/worker.rb

Instance Method Summary collapse

Instance Method Details

#after(&block) ⇒ Object



15
16
17
18
19
# File 'lib/lavin/worker.rb', line 15

def after(&block)
  return @after unless block

  @after = Hook.new(user: self, type: :after, &block)
end

#before(&block) ⇒ Object



9
10
11
12
13
# File 'lib/lavin/worker.rb', line 9

def before(&block)
  return @before unless block

  @before = Hook.new(user: self, type: :before, &block)
end

#step(name: nil, **options, &block) ⇒ Object



25
26
27
28
# File 'lib/lavin/worker.rb', line 25

def step(name: nil, **options, &block)
  name ||= "Step##{steps.size + 1}"
  steps << Step.new(user: self, name:, **options, &block)
end

#stepsObject



21
22
23
# File 'lib/lavin/worker.rb', line 21

def steps
  @steps ||= []
end