3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/lev/object.rb', line 3
def self.lev_routine(options={})
class_eval do
include Lev::Routine unless options[:skip_routine_include]
options[:transaction] ||= Lev::TransactionIsolation.mysql_default.symbol
@transaction_isolation = Lev::TransactionIsolation.new(options[:transaction])
@job_class = options[:job_class]
@active_job_enqueue_options = options[:active_job_enqueue_options]
@raise_fatal_errors = options[:raise_fatal_errors]
@delegates_to = options[:delegates_to]
if @delegates_to
uses_routine @delegates_to,
translations: {
outputs: { type: :verbatim },
inputs: { type: :verbatim }
}
@express_output ||= @delegates_to.express_output
end
@express_output ||= options[:express_output] || self.name.demodulize.underscore
if options[:use_jobba]
self.create_status_proc = ->(*) { Jobba::Status.create! }
self.find_status_proc = ->(id) { Jobba::Status.find!(id) }
end
end
end
|