Class: Totoro::Config
- Inherits:
-
Object
- Object
- Totoro::Config
- Defined in:
- lib/totoro/config.rb
Instance Method Summary collapse
- #clean_start?(id) ⇒ Boolean
- #connect ⇒ Object
- #exchange(id) ⇒ Object
- #exchange_name_for_queue(queue_id) ⇒ Object
- #exchange_persistent?(id) ⇒ Boolean
- #force_ack?(id) ⇒ Boolean
-
#initialize(prefix = nil) ⇒ Config
constructor
A new instance of Config.
- #manual_ack?(id) ⇒ Boolean
- #queue(id) ⇒ Object
- #queue_persistent?(id) ⇒ Boolean
- #reset_data ⇒ Object
Constructor Details
permalink #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
permalink #clean_start?(id) ⇒ Boolean
34 35 36 |
# File 'lib/totoro/config.rb', line 34 def clean_start?(id) !!@data[:queue][id][:clean_start] end |
permalink #connect ⇒ Object
[View source]
14 15 16 |
# File 'lib/totoro/config.rb', line 14 def connect @data[:connect] end |
permalink #exchange(id) ⇒ Object
[View source]
18 19 20 |
# File 'lib/totoro/config.rb', line 18 def exchange(id) @data[:exchange][id][:name] end |
permalink #exchange_name_for_queue(queue_id) ⇒ Object
[View source]
22 23 24 |
# File 'lib/totoro/config.rb', line 22 def exchange_name_for_queue(queue_id) @data[:queue][queue_id][:exchange] end |
permalink #exchange_persistent?(id) ⇒ Boolean
30 31 32 |
# File 'lib/totoro/config.rb', line 30 def exchange_persistent?(id) !!@data[:exchange][id][:persistent] end |
permalink #force_ack?(id) ⇒ Boolean
42 43 44 |
# File 'lib/totoro/config.rb', line 42 def force_ack?(id) manual_ack?(id) && !!@data[:queue][id][:force_ack] end |
permalink #manual_ack?(id) ⇒ Boolean
38 39 40 |
# File 'lib/totoro/config.rb', line 38 def manual_ack?(id) !!@data[:queue][id][:manual_ack] end |
permalink #queue(id) ⇒ Object
[View source]
46 47 48 49 50 |
# File 'lib/totoro/config.rb', line 46 def queue(id) name = @data[:queue][id][:name] settings = { durable: @data[:queue][id][:durable] } [name, settings] end |
permalink #queue_persistent?(id) ⇒ Boolean
26 27 28 |
# File 'lib/totoro/config.rb', line 26 def queue_persistent?(id) !!@data[:queue][id][:persistent] end |
permalink #reset_data ⇒ Object
[View source]
10 11 12 |
# File 'lib/totoro/config.rb', line 10 def reset_data @data = nil end |