Class: QueueConfig
- Inherits:
-
Struct
- Object
- Struct
- QueueConfig
- Defined in:
- lib/proletariat/queue_config.rb
Overview
Internal: Value object to hold RabbitMQ settings.
Instance Attribute Summary collapse
-
#auto_delete ⇒ Object
Returns the value of attribute auto_delete.
-
#routing_keys ⇒ Object
Returns the value of attribute routing_keys.
-
#worker_name ⇒ Object
Returns the value of attribute worker_name.
Instance Method Summary collapse
-
#queue_name ⇒ Object
Public: Create an underscored RabbitMQ queue name from the worker_name.
Instance Attribute Details
#auto_delete ⇒ Object
Returns the value of attribute auto_delete
2 3 4 |
# File 'lib/proletariat/queue_config.rb', line 2 def auto_delete @auto_delete end |
#routing_keys ⇒ Object
Returns the value of attribute routing_keys
2 3 4 |
# File 'lib/proletariat/queue_config.rb', line 2 def routing_keys @routing_keys end |
#worker_name ⇒ Object
Returns the value of attribute worker_name
2 3 4 |
# File 'lib/proletariat/queue_config.rb', line 2 def worker_name @worker_name end |
Instance Method Details
#queue_name ⇒ Object
Public: Create an underscored RabbitMQ queue name from the worker_name.
Examples
config = QueueConfig.new('ExampleWorker', ...)
config.queue_name
# => 'example_worker'
Returns the queue name as a String.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/proletariat/queue_config.rb', line 12 def queue_name @queue_name ||= begin worker_name .gsub(/::/, '/') .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') .gsub(/([a-z\d])([A-Z])/, '\1_\2') .tr('-', '_') .downcase end end |