Class: Totoro::Config

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

Instance Method Summary collapse

Constructor Details

#initialize(prefix = nil) ⇒ Config

Returns a new instance of Config.



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

def initialize(prefix = nil)
  @data = Rails.application.config_for(:totoro).with_indifferent_access
  @data = @data[prefix] if prefix.present?
end

Instance Method Details

#clean_start?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/totoro/config.rb', line 26

def clean_start?
  @data[:queue][id][:clean_start]
end

#connectObject



14
15
16
# File 'lib/totoro/config.rb', line 14

def connect
  @data[:connect]
end

#exchange(id) ⇒ Object



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

def exchange(id)
  @data[:exchange][id][:name]
end

#exchange_name_for_queue(queue_id) ⇒ Object



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

def exchange_name_for_queue(queue_id)
  @data[:queue][queue_id][:exchange]
end

#queue(id) ⇒ Object



30
31
32
33
34
# File 'lib/totoro/config.rb', line 30

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

#reset_dataObject



10
11
12
# File 'lib/totoro/config.rb', line 10

def reset_data
  @data = nil
end