Class: GuideEmUp::Browser
- Inherits:
-
Goliath::API
- Object
- Goliath::API
- GuideEmUp::Browser
- Defined in:
- lib/guide-em-up/browser.rb
Instance Method Summary collapse
-
#initialize(dir) ⇒ Browser
constructor
A new instance of Browser.
- #response(env) ⇒ Object
Constructor Details
Instance Method Details
#response(env) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/guide-em-up/browser.rb', line 16 def response(env) path_info = Rack::Utils.unescape(env["PATH_INFO"]) filename = File.join(@root, path_info) datafile = File.join(@data, path_info) if File.file?(filename) serve_guide(filename) elsif filename.include? ".." elsif File.directory?(filename) serve_index(filename) elsif path_info =~ /\/g-e-u\/theme\/(\w+)$/ @theme.current = $1 redirect_to env["HTTP_REFERER"] || "http://#{env["HTTP_HOST"]}/" elsif path_info =~ /\/g-e-u\/(css|images|icons|js)\// serve_data(datafile.sub 'g-e-u', '') else page_not_found(path_info) end end |