Method: Natsy::Controller.subject
- Defined in:
- lib/natsy/controller.rb
.subject(subject_segment, queue: nil) ⇒ Object
Use the ::subject macro to create a block for listening to that subject segment. Nested calls to ::subject will append each subsequent subject/pattern string to the last (joined by a periods). There is no limit to the level of nesting.
NOTE: The following two examples do exactly the same thing.
92 93 94 95 96 97 98 99 |
# File 'lib/natsy/controller.rb', line 92 def subject(subject_segment, queue: nil) subject_chain.push(subject_segment) old_queue = current_queue self.current_queue = queue if Utils.present?(queue) yield self.current_queue = old_queue subject_chain.pop end |