Sha256: 924dfc424f1a1ddb4d05a111b26a5273b33301efc3273a340b57fcd15b97182f

Contents?: true

Size: 550 Bytes

Versions: 11

Compression:

Stored size: 550 Bytes

Contents

module Grape
  module Parser
    module Base

      class << self

        PARSERS = {
          :json => 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

11 entries across 11 versions & 1 rubygems

Version Path
grape-0.6.0 lib/grape/parser/base.rb
grape-0.5.0 lib/grape/parser/base.rb
grape-0.4.1 lib/grape/parser/base.rb
grape-0.4.0 lib/grape/parser/base.rb
grape-0.3.2 lib/grape/parser/base.rb
grape-0.3.1 lib/grape/parser/base.rb
grape-0.3.0 lib/grape/parser/base.rb
grape-0.2.6 lib/grape/parser/base.rb
grape-0.2.5 lib/grape/parser/base.rb
grape-0.2.4 lib/grape/parser/base.rb
grape-0.2.3 lib/grape/parser/base.rb