Created
August 9, 2012 06:14
-
-
Save kgrz/3301573 to your computer and use it in GitHub Desktop.
Sinatra OO style using helpers
This file contains 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 | |
my_domain.say_hello | |
end | |
get '/bye' do | |
my_domain.say_goodbye | |
end | |
helpers do | |
def my_domain | |
MyDomain.new | |
end | |
end | |
class MyDomain | |
def say_hello | |
"Hello World" | |
end | |
def say_goodbye | |
"Goodbye" | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment