Module: Gnarly::Understands

Includes:
Base, Status
Included in:
Environment
Defined in:
lib/gnarly/understands.rb

Instance Method Summary collapse

Methods included from Status

#created, #default_content_type, #internal_server_error, #method_not_allowed, #not_acceptable, #not_found, #ok, #pop_default_content_type, #push_default_content_type, #unsupported_media_type

Methods included from Base

#body_charset, #logger, #request, #state

Instance Method Details

#understands(*mimes, &block) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/gnarly/understands.rb', line 10

def understands(*mimes, &block)
  mime = MIMEParse.best_match [request.content_type], mimes.join(",")
  if mime
    block.call mime if block
  else
    unsupported_media_type
  end
end