Sha256: e4fe8a9ed1abe1d6d2a2bf8e3d63d871ad98f037ad136bb467d06f2662474c34

Contents?: true

Size: 634 Bytes

Versions: 3

Compression:

Stored size: 634 Bytes

Contents

module Grape
  module Parser
    extend Util::Registrable

    class << self
      def builtin_parsers
        @builtin_parsers ||= {
          json: Grape::Parser::Json,
          jsonapi: Grape::Parser::Json,
          xml: Grape::Parser::Xml
        }
      end

      def parsers(options)
        builtin_parsers.merge(default_elements).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

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/grape-1.2.5/lib/grape/parser.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/grape-1.2.5/lib/grape/parser.rb
grape-1.2.5 lib/grape/parser.rb