Sha256: 5d818ee6d94fbfbd464de61dfaef1182ee7835a7a648da9af6e9c392a10fd762
Contents?: true
Size: 603 Bytes
Versions: 7
Compression:
Stored size: 603 Bytes
Contents
# encoding: utf-8 module Adhearsion class Router extend ActiveSupport::Autoload autoload :Route attr_reader :routes def initialize(&block) @routes = [] instance_exec(&block) end def route(*args, &block) Route.new(*args, &block).tap do |route| @routes << route end end def match(call) @routes.find { |route| route.match? call } end def handle(call) return unless route = match(call) logger.info "Call #{call.id} selected route \"#{route.name}\" (#{route.target})" route.dispatcher end end end
Version data entries
7 entries across 7 versions & 1 rubygems