sinatra-path

Installation

sudo gem install sinatra-path

Example

require 'sinatra'
require 'sinatra/path'

get '/' do
  'Hello World | <a href="/~signin">signin</a>'
end

path '/~signin' do
  get do
    '
      <html>
      <head>
        <title>signin</title>
      </head>
      <body>
        <form action="" method="post">
          <label for="user">User:</label>
          <input type="text" id="user" name="user" value="" />
          <label for="password">Password:</label>
          <input type="password" id="password" name="password" value="" />
          <input type="submit" name="submit" />
        </form>
      </body>
      </html>
    '
  end

  post do
    p params
  end
end

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Copyright © 2010 Jun Kikuchi. See LICENSE for details.