File: handlers_registry.rb

package info (click to toggle)
ruby-amqp 1.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 2,508 kB
  • sloc: ruby: 8,272; sh: 11; makefile: 10
file content (28 lines) | stat: -rw-r--r-- 359 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
module AMQP
  class HandlersRegistry

    @@handlers ||= Hash.new


    #
    # API
    #


    def self.register(klass, &block)
      @@handlers[klass] = block
    end
    class << self
      alias handle register
    end

    def self.find(klass)
      @@handlers[klass]
    end

    def self.handlers
      @@handlers
    end

  end # HandlersRegistry
end