Skip to content

Instantly share code, notes, and snippets.

@joshbuddy
Created August 25, 2009 21:13
Show Gist options
  • Save joshbuddy/175037 to your computer and use it in GitHub Desktop.
Save joshbuddy/175037 to your computer and use it in GitHub Desktop.
router:
#initialize(parent_router || nil)
#map('path', options = nil)
returned object supports attr_accessor :to
returned object supports attr_accessor :name
#context
returns object with attr_reader :host, :port, :scheme, :base_uri
#recognize(request_object, path)
generator:
#generate(env, name or nil, options, defaults)
-----
context --> generation context only.
map('path', options) ... post-conditions? http method pre-conditions. perhaps based blindly to whatever router receives them.
generate(nil || symbol, parameters, (array or hash), options, (hash))
recognize(path, request)
context -> returns struct of initial context. matches request object? no, this is http specific. http, port scheme base_uri makes sense.
is the routing separate from the generation api? should routers agree to support one api, and routers + generators agree to support a superset of that api?
standard namespace for variables in rack?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment