Sha256: 22291ba36320960bb59390d0659f875090559b716eca669eceae0d65392f0f5a

Contents?: true

Size: 524 Bytes

Versions: 123

Compression:

Stored size: 524 Bytes

Contents

require 'action_dispatch'

module Acfs
  class Response

    # Quick accessors for format handling.
    module Formats

      def content_type
        @content_type ||= read_content_type
      end

      def json?
        content_type == Mime::JSON
      end

      private
      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
    end
  end
end

Version data entries

123 entries across 123 versions & 1 rubygems

Version Path
acfs-0.42.0 lib/acfs/response/formats.rb
acfs-0.41.1 lib/acfs/response/formats.rb
acfs-0.41.1.beta1 lib/acfs/response/formats.rb
acfs-0.41.0 lib/acfs/response/formats.rb
acfs-0.40.1.rc1 lib/acfs/response/formats.rb
acfs-0.40.0 lib/acfs/response/formats.rb
acfs-0.39.1 lib/acfs/response/formats.rb
acfs-0.39.0 lib/acfs/response/formats.rb
acfs-1.0.0.dev.1.b305 lib/acfs/response/formats.rb
acfs-0.38.0 lib/acfs/response/formats.rb
acfs-1.0.0.dev.1.b298 lib/acfs/response/formats.rb
acfs-1.0.0.dev.1.b297 lib/acfs/response/formats.rb
acfs-0.37.0.1.b295 lib/acfs/response/formats.rb
acfs-0.37.0 lib/acfs/response/formats.rb
acfs-0.36.0.1.b293 lib/acfs/response/formats.rb
acfs-0.36.0 lib/acfs/response/formats.rb
acfs-0.35.0.1.b291 lib/acfs/response/formats.rb
acfs-0.35.0 lib/acfs/response/formats.rb
acfs-0.34.1.1.b289 lib/acfs/response/formats.rb
acfs-0.34.1 lib/acfs/response/formats.rb