Created
February 18, 2011 01:37
-
-
Save wmorgan/833102 to your computer and use it in GitHub Desktop.
for @RobotDeathSquad
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'sinatra' | |
$conts = [] | |
def link_to title, &b | |
id = $conts.size | |
$conts[id] = b | |
"<a href='/next/#{id}'>#{title}</a>" | |
end | |
get '/hi', :provides => 'html' do | |
"hello world " + link_to("click here") { "thanks for clicking!" } | |
end | |
get '/next/:id', :provides => 'html' do |id| | |
$conts[id.to_i].call | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment