Class: Rasti::Web::Headers

Inherits:
Object
  • Object
show all
Defined in:
lib/rasti/web/headers.rb

Constant Summary collapse

CONTENT_TYPES =
{
  text: 'text/plain',
  html: 'text/html',
  json: 'application/json',
  js:   'application/javascript',
  css:  'text/css'
}

Class Method Summary collapse

Class Method Details

.for_file(filename, attachment: true, charset: 'utf-8') ⇒ Object



21
22
23
24
# File 'lib/rasti/web/headers.rb', line 21

def for_file(filename, attachment:true, charset:'utf-8')
  merge content_type(MIME::Types.of(filename).first.content_type, charset: charset),
        content_disposition(filename, attachment: attachment)
end