Module: Interactor::Async

Extended by:
Async
Included in:
Async
Defined in:
lib/interactor/async.rb,
lib/interactor/async/version.rb,
lib/interactor/async/null_dispatcher.rb,
lib/interactor/async/active_job_dispatcher.rb

Defined Under Namespace

Classes: ActiveJobDispatcher, NullDispatcher

Constant Summary collapse

VERSION =
"0.0.2"

Instance Method Summary collapse

Instance Method Details

#configObject



14
15
16
# File 'lib/interactor/async.rb', line 14

def config
  @config ||= default_config
end

#configure(&block) ⇒ Object



10
11
12
# File 'lib/interactor/async.rb', line 10

def configure &block
  instance_eval(&block)
end

#default_configObject



22
23
24
25
26
27
28
29
30
# File 'lib/interactor/async.rb', line 22

def default_config
  default_options = if defined?(ActiveJob::Base)
    {job_wrapper: ActiveJobDispatcher}
  else
    {job_wrapper: NullDispatcher}
  end

  OpenStruct.new(default_options)
end

#reset_config!Object



18
19
20
# File 'lib/interactor/async.rb', line 18

def reset_config!
  @config = default_config
end