Sha256: 6cea328627de296be2665add0419cd79438889c48951ad56bbc3fa074d5b960f
Contents?: true
Size: 708 Bytes
Versions: 11
Compression:
Stored size: 708 Bytes
Contents
module Grape module Formatter module Base class << self FORMATTERS = { :json => Grape::Formatter::Json, :serializable_hash => Grape::Formatter::SerializableHash, :txt => Grape::Formatter::Txt, :xml => Grape::Formatter::Xml } def formatters(options) FORMATTERS.merge(options[:formatters] || {}) end def formatter_for(api_format, options = {}) spec = formatters(options)[api_format] case spec when nil lambda { |obj, env| obj } when Symbol method(spec) else spec end end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems