lib/mongrel2/config/route.rb in mongrel2-0.25.0 vs lib/mongrel2/config/route.rb in mongrel2-0.26.0

- old
+ new

@@ -12,9 +12,26 @@ # reversed BOOLEAN DEFAULT 0, # host_id INTEGER, # target_id INTEGER, # target_type TEXT); + + ### Return the Route that corresponds to the given +request+. + def self::for_request( request ) + pattern = request.headers.pattern + return self.filter( path: pattern ).first + end + + + # + # :section: Associations + # + + ## + # The Mongrel2::Config::Host this route belongs to. + many_to_one :host + + ### Fetch the route's target, which is either a Mongrel2::Config::Directory, ### Mongrel2::Config::Proxy, or Mongrel2::Config::Handler object. def target case self.target_type when 'dir'