Method: Beetle::Handler.create

Defined in:
lib/beetle/handler.rb

.create(handler, opts = {}) ⇒ Object

:nodoc:



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/beetle/handler.rb', line 14

def self.create(handler, opts={}) #:nodoc:
  if handler.is_a? Handler
    # a handler instance
    handler
  elsif handler.is_a?(Class) && handler.ancestors.include?(Handler)
    # handler class
    handler.new
  else
    # presumably something which responds to call
    new(handler, opts)
  end
end