Skip to content

Instantly share code, notes, and snippets.

@seanbehan
Created November 19, 2011 00:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seanbehan/1378171 to your computer and use it in GitHub Desktop.
Save seanbehan/1378171 to your computer and use it in GitHub Desktop.
Sinatra Reloaded
require 'sinatra'
get "/" do
@person = Person.new
"Hello #{@person.name}. You are #{@person.born_at} years old!"
end
# Resources
#
# http://rkh.im/code-reloading
# https://github.com/sinatra/sinatra-contrib/
#
require 'sinatra'
require 'sinatra/reloader'
require './models/person'
require './app'
# Info on reloading in docs
# https://github.com/sinatra/sinatra-contrib/blob/master/lib/sinatra/reloader.rb
also_reload "./models/person.rb"
class Person
def name
"Sean Patrick Behan"
end
def born_at
1 + rand(100)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment