Skip to content

Instantly share code, notes, and snippets.

@lenary
Created December 12, 2008 16:31
Show Gist options
  • Save lenary/35181 to your computer and use it in GitHub Desktop.
Save lenary/35181 to your computer and use it in GitHub Desktop.
#!ruby
# i'm sure this needs a require line
Camping.goes :Nuts
module Nuts::Controllers
class Index < R '/'
def get
@t = Time.now.to_s
render :sundial
end
end
end
module Nuts::Views
def layout
html do
head do
title { "Nuts And GORP" }
end
body { self << yield }
end
end
def sundial
p "The current time is: #{@t}"
end
end
#!ruby
require "sinatra"
get '/' do
@t = Time.now.to_s
haml :sundial
end
use_in_file_templates!
__END__
@@ layout
%html
%head
%title
Nuts And GORP
%body
yield
@@ sundial
%p= "The current time is: #{@t}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment