Sha256: 068aae127b26599cddf2500089b4f63b907768743a50777a69a655660514dfa1
Contents?: true
Size: 893 Bytes
Versions: 3
Compression:
Stored size: 893 Bytes
Contents
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.beta1 | lib/adhearsion/router/route.rb |
adhearsion-2.0.0.alpha3 | lib/adhearsion/router/route.rb |
adhearsion-2.0.0.alpha2 | lib/adhearsion/router/route.rb |