Class: Merb::Responder

Inherits:
Object show all
Defined in:
lib/merb-core/controller/mixins/responder.rb

Class Method Summary collapse

Class Method Details

.parse(accept_header) ⇒ Object

Parses the raw accept header into an array of sorted AcceptType objects.

Parameters

accept_header<~to_s>

The raw accept header.

Returns

Array

The accepted types.



396
397
398
399
400
401
402
403
404
# File 'lib/merb-core/controller/mixins/responder.rb', line 396

def self.parse(accept_header)
  headers = accept_header.split(/,/)
  idx, list = 0, []
  while idx < headers.size
    list << AcceptType.new(headers[idx], idx)
    idx += 1
  end
  list.sort
end