class Bellbro::Worker
Attributes
context[R]
Public Class Methods
should_run?()
click to toggle source
# File lib/bellbro/worker.rb, line 37 def self.should_run? # override true end
Public Instance Methods
call()
click to toggle source
# File lib/bellbro/worker.rb, line 25 def call # override end
debug?()
click to toggle source
# File lib/bellbro/worker.rb, line 33 def debug? @debug ||= !!context[:debug] rescue false end
perform(args)
click to toggle source
# File lib/bellbro/worker.rb, line 13 def perform(args) return unless args.present? set_context(args) run_before_hooks return if aborted? call return if aborted? run_after_hooks ensure run_always_hooks end
should_run?()
click to toggle source
# File lib/bellbro/worker.rb, line 29 def should_run? self.class.should_run? || abort! end
Private Instance Methods
set_context(args)
click to toggle source
# File lib/bellbro/worker.rb, line 44 def set_context(args) if args.is_a?(Hash) @context = args.symbolize_keys else @context = args end end