Module: Grape::ContentTypes
- Defined in:
- lib/grape/util/content_types.rb
Constant Summary collapse
- CONTENT_TYPES =
Content types are listed in order of preference.
ActiveSupport::OrderedHash[ :xml, 'application/xml', :serializable_hash, 'application/json', :json, 'application/json', :binary, 'application/octet-stream', :txt, 'text/plain' ]
Class Method Summary collapse
Class Method Details
.content_types_for(from_settings) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/grape/util/content_types.rb', line 18 def self.content_types_for(from_settings) if from_settings.present? from_settings else Grape::ContentTypes::CONTENT_TYPES end end |
.content_types_for_settings(settings) ⇒ Object
12 13 14 15 16 |
# File 'lib/grape/util/content_types.rb', line 12 def self.content_types_for_settings(settings) return nil if settings.nil? || settings.blank? settings.each_with_object(ActiveSupport::OrderedHash.new) { |value, result| result.merge!(value) } end |