Module: UseCase::BaseClassMethod::ClassMethods

Defined in:
lib/usecasing/base.rb

Instance Method Summary collapse

Instance Method Details

#dependenciesObject



16
17
18
19
20
# File 'lib/usecasing/base.rb', line 16

def dependencies
  return [] unless superclass.ancestors.include? UseCase::Base
  value = (@dependencies && @dependencies.dup || []).concat(superclass.dependencies)
  value
end

#depends(*deps) ⇒ Object



11
12
13
14
# File 'lib/usecasing/base.rb', line 11

def depends(*deps)
  @dependencies ||= []
  @dependencies.push(*deps)
end

#perform(ctx = { }) ⇒ Object



22
23
24
25
26
# File 'lib/usecasing/base.rb', line 22

def perform(ctx = { })
  tx(ExecutionOrder.run(self), ctx) do |usecase, context| 
    usecase.new(context).perform 
  end
end