Module: Reactor::Workers::Configuration

Extended by:
ActiveSupport::Concern
Included in:
EventWorker, MailerWorker
Defined in:
lib/reactor/workers/concerns/configuration.rb

Constant Summary collapse

CONFIG =
[:source, :action, :delay, :deprecated]

Instance Method Summary collapse

Instance Method Details

#configured?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/reactor/workers/concerns/configuration.rb', line 36

def configured?
  self.class.configured?
end

#perform(data) ⇒ Object



40
41
42
43
44
45
46
47
48
49
# File 'lib/reactor/workers/concerns/configuration.rb', line 40

def perform(data)
  raise_unconfigured! unless configured?
  return :__perform_aborted__ unless should_perform?
  event = Reactor::Event.new(data)
  if action.is_a?(Symbol)
    source.send(action, event)
  else
    action.call(event)
  end
end

#should_perform?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/reactor/workers/concerns/configuration.rb', line 51

def should_perform?
  true
end