Sha256: d25133cd41c1d3285f7e9485d3bbb97f24e68ec713c13b40d4132a671352715d
Contents?: true
Size: 912 Bytes
Versions: 3
Compression:
Stored size: 912 Bytes
Contents
# encoding: utf-8 module Adhearsion class Router class Route include HasGuardedHandlers attr_reader :name, :target, :guards def initialize(name, target = nil, *guards, &block) @name = name if block @target, @guards = block, ([target] + guards) else @target, @guards = target, guards end @guards.compact! end def match?(call) !guarded? guards, call end def dispatcher @dispatcher ||= lambda do |call| controller = if target.respond_to?(:call) CallController.new call, &target else target.new call end call.execute_controller controller end end def inspect "#<#{self.class}:#{object_id} name=#{name} target=#{target} guards=#{guards}>" end alias :to_s :inspect end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
adhearsion-2.0.0.rc3 | lib/adhearsion/router/route.rb |
adhearsion-2.0.0.rc2 | lib/adhearsion/router/route.rb |
adhearsion-2.0.0.rc1 | lib/adhearsion/router/route.rb |