Sha256: 7bd13dbb3db1b58eada176dcdd7c728d099e30bd2a79d392f7e7778fa4775466

Contents?: true

Size: 404 Bytes

Versions: 2

Compression:

Stored size: 404 Bytes

Contents

require 'action_dispatch'

module Acfs
  class Response

    # Quick accessors for format handling.
    module Formats

      def content_type
        @content_type ||= begin
          content_type = headers['Content-Type'].split(/;\s*\w+="?\w+"?/).first
          Mime::Type.parse(content_type).first
        end
      end

      def json?
        content_type == Mime::JSON
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
acfs-0.7.0 lib/acfs/response/formats.rb
acfs-0.6.0 lib/acfs/response/formats.rb