Class: Emque::Consuming::Control

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/emque/consuming/control.rb,
lib/emque/consuming/control/errors.rb,
lib/emque/consuming/control/workers.rb

Defined Under Namespace

Classes: Errors, Workers

Instance Method Summary collapse

Constructor Details

#initializeControl

Returns a new instance of Control.



9
10
11
12
# File 'lib/emque/consuming/control.rb', line 9

def initialize
  @errors = Emque::Consuming::Control::Errors.new
  @workers = Emque::Consuming::Control::Workers.new
end

Instance Method Details

#errors(*args) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/emque/consuming/control.rb', line 14

def errors(*args)
  if args[0] && @errors.respond_to?(args[0])
    @errors.send(args.shift, *args)
    true
  else
    @errors
  end
end

#workers(topic = nil, command = nil, *args) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/emque/consuming/control.rb', line 23

def workers(topic = nil, command = nil, *args)
  if command && topic && @workers.respond_to?(command)
    @workers.send(command, topic, *args)
    true
  else
    @workers
  end
end