Module: Grape::Formatter::Base
- Defined in:
- lib/grape/formatter/base.rb
Constant Summary collapse
- FORMATTERS =
- { json: Grape::Formatter::Json, jsonapi: Grape::Formatter::Json, serializable_hash: Grape::Formatter::SerializableHash, txt: Grape::Formatter::Txt, xml: Grape::Formatter::Xml } 
Class Method Summary collapse
Class Method Details
.formatter_for(api_format, options = {}) ⇒ Object
| 17 18 19 20 21 22 23 24 25 26 27 | # File 'lib/grape/formatter/base.rb', line 17 def formatter_for(api_format, = {}) spec = formatters()[api_format] case spec when nil lambda { |obj, env| obj } when Symbol method(spec) else spec end end | 
.formatters(options) ⇒ Object
| 13 14 15 | # File 'lib/grape/formatter/base.rb', line 13 def formatters() FORMATTERS.merge([:formatters] || {}) end |