Class: Flame::Dispatcher::Response

Inherits:
Rack::Response
  • Object
show all
Defined in:
lib/flame/dispatcher/response.rb

Overview

Class for responses

Instance Method Summary collapse

Instance Method Details

#content_type=(value) ⇒ String

Set Content-Type header directly or by extension

Examples:

Set value directly

content_type = 'text/css'

Set value by file extension

content_type = '.css'

Parameters:

  • value (String)

    value for header or extension of file

Returns:

  • (String)

    setted value



14
15
16
17
# File 'lib/flame/dispatcher/response.rb', line 14

def content_type=(value)
	value = Rack::Mime.mime_type(value) if value.start_with? '.'
	set_header Rack::CONTENT_TYPE, value
end