Sha256: 27722996a1345663d0d0cf310f71a53f4d8e5174a37d10ce703023407283a67a

Contents?: true

Size: 1.64 KB

Versions: 4

Compression:

Stored size: 1.64 KB

Contents

= Usher 

Tree-based router for Ruby on Rails.

This is a tree-based router (based on Ilya Grigorik suggestion). Turns out looking up in a hash and following a tree is faster than Krauter's massive regex approach, so why not? I said, Heck Yes, and here we are.

== Route format

Here are some examples of routes recognized by usher (so far)

  _Route_                  _Matches_
  /path/to/something       /path/to/something
  /path/:variable/more     /path/foo/more, /path/bar/more ...
  /show/*tags              /show/hot /show/hot/coffee /show/some/more/hot/coffee ...
  /route(/help)            /route, /route/help
  /route(.:format)         /route, /route.xml, /route.html ...

== Rails

  script/plugin install git://github.com/joshbuddy/usher.git

== Rack

=== rackup.ru

  require 'usher'
  app = proc do |env|
    body = "Hi there #{env['usher.params'][:name]}"
    [
      200,          # Status code
      {             # Response headers
        'Content-Type' => 'text/plain',
        'Content-Length' => body.size.to_s,
      },
      [body]        # Response body
    ]
  end
  
  routes = Usher::Interface.for(:rack)
  routes.add('/hello/:name').to(app)
  run routes

------------

  >> curl http://127.0.0.1:3000/hello/samueltanders
  << Hi there samueltanders

== DONE

* add support for () optional parts

== TODO

* Add support for arbitrary HTTP header checks
* Make it integrate with merb
* Make it integrate with rails3
* Create decent DSL for use with rack
* Emit exceptions inline with relevant interfaces
* More RDoc! (optionally cowbell)

Looks about 20-50% faster than the router Rails ships with for non-trivial cases.

(Let me show you to your request)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
joshbuddy-usher-0.0.2 README.rdoc
joshbuddy-usher-0.0.3 README.rdoc
joshbuddy-usher-0.1.0 README.rdoc
joshbuddy-usher-0.1.1 README.rdoc