Sha256: 235aded641221ef8ecf54a7febca4f2c4ec01ac4b63c78143bf80d44e47819bd
Contents?: true
Size: 868 Bytes
Versions: 1
Compression:
Stored size: 868 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.21.2 | lib/nitro/dispatcher/nice.rb |