vendor/bundle/ruby/2.2.0/gems/grape-0.7.0/lib/grape/api.rb
# Specify the format for the API's serializers.
# May be `:json`, `:xml`, `:txt`, etc.
Specify the format for the API's serializers.
Specify the format for the API ' s serializers .
def format(new_format = nil)
        if new_format
          set(:format, new_format.to_sym)
          set(:default_error_formatter, Grape::ErrorFormatter::Base.formatter_for(new_format, {}))
          mime_type = content_types[new_format.to_sym]
          raise Grape::Exceptions::MissingMimeType.new(new_format) unless mime_type
          settings.imbue(:content_types, new_format.to_sym => mime_type)
        else
          settings[:format]
        end
      end
def format ( new_format = nil ) if new_format set ( :format , new_format . to_sym ) set ( :default_error_formatter , Grape :: ErrorFormatter :: Base . formatter_for ( new_format , { } ) ) mime_type = content_types [ new_format . to_sym ] raise Grape :: Exceptions :: MissingMimeType . new ( new_format ) unless mime_type settings . imbue ( :content_types , new_format . to_sym => mime_type ) else settings [ :format ] end end
Specify the format for the API's serializers.
Specify the format for the API ' s serializers .
# define the default error formatters # define a single mime type
new_format
<not_specific>