module Kaffe::Routes

Public Class Methods

included(base) click to toggle source
# File lib/kaffe/routes.rb, line 25
def self.included(base)
  base.extend(ClassMethods)
end

Public Instance Methods

route!() click to toggle source
# File lib/kaffe/routes.rb, line 12
def route!
  path = env["PATH_INFO"].to_s
  self.class.routes.each do |exp, app|
    if path.match exp 
      match = $~.to_s
      throw :success, app.call(env.merge(
        "PATH_INFO"   => path[match.size..-1],
        "SCRIPT_NAME" => match))         
    end
  end
  nil
end