Sha256: 36e508b18d6c4e033e6c97b73ee38d36397ab9e857677268c70b53f732427695
Contents?: true
Size: 869 Bytes
Versions: 1
Compression:
Stored size: 869 Bytes
Contents
require 'nitro/dispatcher' module Nitro # Specialize the Dispatcher to handle implicit 'nice' urls. class Dispatcher # An alternative dispatching algorithm that handles # implicit nice urls. Subdirectories are not supported. def dispatch(path, context) path = route(path, context) parts = path.split('/') parts.shift # get rid of the leading '/'. if klass = controller_class_for("/#{parts.first}") base = "/#{parts.shift}" else base = ROOT klass = controller_class_for(ROOT) end unless action = parts.shift action = 'index' end unless parts.empty? context.headers['QUERY_STRING'] = "#{parts.join(';')};#{context.headers['QUERY_STRING']}" end return klass, "#{action}_action", base end end Dispatcher.mode = :nice end # * George Moschovitis <gm@navel.gr>
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nitro-0.22.0 | lib/nitro/dispatcher/nice.rb |