Created
November 19, 2011 00:12
-
-
Save seanbehan/1378171 to your computer and use it in GitHub Desktop.
Sinatra Reloaded
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
require 'sinatra' | |
get "/" do | |
@person = Person.new | |
"Hello #{@person.name}. You are #{@person.born_at} years old!" | |
end |
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
# 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" |
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
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