Class: Totoro::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/totoro/config.rb

Class Method Summary collapse

Class Method Details

.connectObject



12
13
14
# File 'lib/totoro/config.rb', line 12

def connect
  data[:connect]
end

.dataObject



4
5
6
# File 'lib/totoro/config.rb', line 4

def data
  @data ||= Rails.application.config_for(:totoro).with_indifferent_access
end

.get_worker(worker_class) ⇒ Object



22
23
24
# File 'lib/totoro/config.rb', line 22

def get_worker(worker_class)
  ::Worker.const_get(worker_class.to_s.camelize).new
end

.queue(id) ⇒ Object



16
17
18
19
20
# File 'lib/totoro/config.rb', line 16

def queue(id)
  name = data[:queue][id][:name]
  settings = { durable: data[:queue][id][:durable] }
  [name, settings]
end

.reset_dataObject



8
9
10
# File 'lib/totoro/config.rb', line 8

def reset_data
  @data = nil
end