Module: Plumbing::Actor::Configuration

Included in:
Plumbing::Actor
Defined in:
lib/plumbing/actor/configuration.rb

Instance Method Summary collapse

Instance Method Details

#register(name, &builder) ⇒ Object



20
21
22
# File 'lib/plumbing/actor/configuration.rb', line 20

def register name, &builder
  worker_types[name.to_sym] = builder
end

#selected_worker_typeObject



14
15
16
# File 'lib/plumbing/actor/configuration.rb', line 14

def selected_worker_type
  @selected_worker_type ||= :inline
end

#uses(name) ⇒ Object



10
11
12
# File 'lib/plumbing/actor/configuration.rb', line 10

def uses name
  @selected_worker_type = name.to_sym
end

#worker_for(actor) ⇒ Object



6
7
8
# File 'lib/plumbing/actor/configuration.rb', line 6

def worker_for actor
  worker_types[selected_worker_type].call(actor)
end

#worker_typesObject



24
25
26
# File 'lib/plumbing/actor/configuration.rb', line 24

def worker_types
  @worker_types ||= {inline: ->(actor) { Plumbing::Actor::Inline.new(actor: actor) }}
end

#workersObject



18
# File 'lib/plumbing/actor/configuration.rb', line 18

def workers = worker_types.keys