Sha256: b85c1f9b4973e21361d2ce2ea3d12da7e435e0fbe2d8bdab8a2fc2d9422168e5

Contents?: true

Size: 584 Bytes

Versions: 1

Compression:

Stored size: 584 Bytes

Contents

module Grape
  module Parser
    module Base

      class << self

        PARSERS = {
          json: Grape::Parser::Json,
          jsonapi: Grape::Parser::Json,
          xml: Grape::Parser::Xml
        }

        def parsers(options)
          PARSERS.merge(options[:parsers] || {})
        end

        def parser_for(api_format, options = {})
          spec = parsers(options)[api_format]
          case spec
          when nil
            nil
          when Symbol
            method(spec)
          else
            spec
          end
        end

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
grape-0.6.1 lib/grape/parser/base.rb