Module: Messaging::Routing::ClassMethods
- Defined in:
- lib/messaging/routing.rb,
lib/messaging/routing_23.rb
Instance Method Summary collapse
Instance Method Details
#definitions ⇒ Object
13 14 15 |
# File 'lib/messaging/routing.rb', line 13 def definitions @definitions ||= [] end |
#new(*args, &block) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/messaging/routing.rb', line 21 def new(*args, **, &block) instance = allocate # Pre-initialize definitions.each do |definition| instance.on(definition[:pattern], definition[:options], &definition[:block]) end instance.send(:initialize, *args, **, &block) instance end |
#on(pattern, **options, &block) ⇒ Object
17 18 19 |
# File 'lib/messaging/routing.rb', line 17 def on(pattern, **, &block) definitions << { pattern: pattern, options: , block: block } end |