Class: CottonTail::DSL::Topic
- Inherits:
-
Object
- Object
- CottonTail::DSL::Topic
- Defined in:
- lib/cotton_tail/dsl/topic.rb
Overview
Topic DSL
Instance Method Summary collapse
- #handle(routing_suffix, handler = nil, &block) ⇒ Object
-
#initialize(routing_prefix, context) ⇒ Topic
constructor
A new instance of Topic.
Constructor Details
#initialize(routing_prefix, context) ⇒ Topic
Returns a new instance of Topic.
7 8 9 10 |
# File 'lib/cotton_tail/dsl/topic.rb', line 7 def initialize(routing_prefix, context) @routing_prefix = routing_prefix @context = context end |
Instance Method Details
#handle(routing_suffix, handler = nil, &block) ⇒ Object
12 13 14 15 |
# File 'lib/cotton_tail/dsl/topic.rb', line 12 def handle(routing_suffix, handler = nil, &block) key = routing_key(routing_suffix) @context.instance_eval { handle key, handler, &block } end |