Module: Interactor::Async

Defined in:
lib/interactor/async.rb,
lib/interactor/async/version.rb

Defined Under Namespace

Modules: ClassMethods Classes: Dispatcher

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.configObject



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

def config
  @config ||= default_config
end

.configure(&block) ⇒ Object



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

def configure &block
  instance_eval(&block)
end

.default_configObject



27
28
29
30
31
32
33
34
35
# File 'lib/interactor/async.rb', line 27

def default_config
  default_options = if defined?(Dispatcher)
    {job_wrapper: Dispatcher}
  else
    {}
  end

  OpenStruct.new(default_options)
end

.included(base) ⇒ Object



37
38
39
# File 'lib/interactor/async.rb', line 37

def included(base)
  base.extend ClassMethods
end

.reset_config!Object



23
24
25
# File 'lib/interactor/async.rb', line 23

def reset_config!
  @config = default_config
end