module Acfs::Response::Formats
Quick accessors for format handling.
Public Instance Methods
content_type()
click to toggle source
# File lib/acfs/response/formats.rb, line 9 def content_type @content_type ||= read_content_type end
json?()
click to toggle source
# File lib/acfs/response/formats.rb, line 13 def json? content_type == Mime[:json] end
Private Instance Methods
read_content_type()
click to toggle source
# File lib/acfs/response/formats.rb, line 19 def read_content_type return 'text/plain' unless headers && headers['Content-Type'] content_type = headers['Content-Type'].split(/;\s*\w+="?\w+"?/).first Mime::Type.parse(content_type).first end