Class: Otto::RouteHandlers::HandlerFactory
- Inherits:
-
Object
- Object
- Otto::RouteHandlers::HandlerFactory
- Defined in:
- lib/otto/route_handlers.rb
Overview
Factory for creating appropriate handlers based on route definitions
Class Method Summary collapse
-
.create_handler(route_definition, otto_instance = nil) ⇒ BaseHandler
Create a handler for the given route definition.
Class Method Details
.create_handler(route_definition, otto_instance = nil) ⇒ BaseHandler
Create a handler for the given route definition
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/otto/route_handlers.rb', line 14 def self.create_handler(route_definition, otto_instance = nil) case route_definition.kind when :logic LogicClassHandler.new(route_definition, otto_instance) when :instance InstanceMethodHandler.new(route_definition, otto_instance) when :class ClassMethodHandler.new(route_definition, otto_instance) else raise ArgumentError, "Unknown handler kind: #{route_definition.kind}" end end |