Module: Rapid::Server::Helpers::Files

Defined in:
lib/ury_rapid/server/helpers/files.rb

Overview

Sinatra helpers for serving static files

Instance Method Summary collapse

Instance Method Details

#serve_text(type, directory) ⇒ Object


6
7
8
9
10
# File 'lib/ury_rapid/server/helpers/files.rb', line 6

def serve_text(type, directory)
  content_type "text/#{type}", charset: 'utf-8'
  filename = params[:splat].first
  send_file File.join(settings.root, 'assets', directory, filename)
end