Adds route redirects

This commit is contained in:
Harman Singh 2017-05-29 17:27:21 +05:30
parent 1edd85ebf8
commit 9295d66042
1 changed files with 8 additions and 2 deletions

10
app.rb
View File

@ -5,7 +5,13 @@ require 'yaml'
def get_url(domain_object, rel_route)
if domain_object.is_a? Hash
return domain_object['root'] + "/" + rel_route
if domain_object.key? 'root'
domain_object['root'] + '/' + rel_route
elsif domain_object.key? rel_route
domain_object[rel_route]
else
domain_object.values.first
end
elsif domain_object.is_a? String
return domain_object
end
@ -27,4 +33,4 @@ get '/*' do
end
halt 404, "#{hostname} hasn't been setup yet."
end
end