This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
.document | Wed Apr 22 03:59:46 -0700 2009 | |
| |
.gitignore | Wed Apr 22 04:31:20 -0700 2009 | |
| |
LICENSE | Wed Apr 22 04:31:12 -0700 2009 | |
| |
README.rdoc | Wed Apr 22 05:17:30 -0700 2009 | |
| |
Rakefile | Wed Apr 22 05:10:46 -0700 2009 | |
| |
VERSION.yml | Wed Apr 22 05:11:03 -0700 2009 | |
| |
lib/ | Wed Apr 22 04:31:12 -0700 2009 | |
| |
sinatra-url-for.gemspec | Wed Apr 22 05:12:24 -0700 2009 | |
| |
spec/ | Wed Apr 22 04:31:12 -0700 2009 |
README.rdoc
sinatra-url-for
sinatra-url-for constructs absolute paths and full URLs for handlers in a Sinatra application. Assuming that your application is running on example.com, and that it has been mapped to /myapp, you should be able call url_for from within a handler as follows:
url_for "/" # Returns "/myapp/" url_for "/foo" # Returns "/myapp/foo" url_for "/foo", :full # Returns "http://example.com/myapp/foo"
To install it, run:
sudo gem install emk-sinatra-url-for -s http://gems.github.com
To include it in a Sinatra application, write:
require 'rubygems' gem 'emk-sinatra-url-for' require 'sinatra/url_for'
If you’re subclassing Sinatra::Base, then you need to call helpers manually:
class MyApp < Sinatra::Base
helpers Sinatra::UrlForHelper
# ...
end
Thanks to "cypher23" on #mephisto and the folks on #rack for pointing me in the right direction. If this gem fails to work correctly on your system, please feel free to submit patches and/or bug reports!
Copyright
Copyright 2009 Eric Kidd. See LICENSE for details.







