Class: AtechDocs::Server
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- AtechDocs::Server
- Defined in:
- lib/atech_docs/server.rb
Instance Method Summary collapse
Instance Method Details
#find(application, path) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/atech_docs/server.rb', line 46 def find(application, path) request_path = [application, path].join('/') path_to_file = File.join(ARGV.last, application, path) if File.file?(path_to_file + '.doc') Page.new(request_path, File.read(path_to_file + '.doc')) elsif File.directory?(path_to_file) && File.join(path_to_file, 'index.doc') Page.new(request_path, File.read(File.join(path_to_file, 'index.doc'))) else nil end end |