Sha256: c8eb692a890250b918c00a29e8d873610f37dbacdcaf8920ff9e33ef9d878d87

Contents?: true

Size: 581 Bytes

Versions: 10

Compression:

Stored size: 581 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

10 entries across 10 versions & 2 rubygems

Version Path
grape-security-0.8.0 lib/grape/parser/base.rb
grape-0.14.0 lib/grape/parser/base.rb
grape-0.13.0 lib/grape/parser/base.rb
grape-0.12.0 lib/grape/parser/base.rb
grape-0.11.0 lib/grape/parser/base.rb
grape-0.10.1 lib/grape/parser/base.rb
grape-0.10.0 lib/grape/parser/base.rb
grape-0.9.0 lib/grape/parser/base.rb
grape-0.8.0 lib/grape/parser/base.rb
grape-0.7.0 lib/grape/parser/base.rb