Sha256: afa73292796f71236783560d8bfab746c7b2734386c30fa562ccfc382e9153b8

Contents?: true

Size: 510 Bytes

Versions: 4

Compression:

Stored size: 510 Bytes

Contents

module Raisin
  module ApiFormat
    def formats
      @env["action_dispatch.request.formats"] ||= 
        if @env.key?('raisin.format')
          Array(Mime::Type.lookup(@env['raisin.format']))
        elsif parameters[:format]
          Array(Mime[parameters[:format]])
        elsif use_accept_header && valid_accept_header
          accepts
        elsif xhr?
          [Mime::JS]
        else
          [Mime::HTML]
        end
    end
  end
end

ActionDispatch::Request.send(:include, Raisin::ApiFormat)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
raisin-0.1.1 lib/raisin/rails/request.rb
raisin-0.1.0 lib/raisin/rails/request.rb
raisin-0.0.5 lib/raisin/rails/request.rb
raisin-0.0.4 lib/raisin/rails/request.rb