Module: Wayfarer::Parsing
- Defined in:
- lib/wayfarer/parsing.rb,
lib/wayfarer/parsing/xml.rb,
lib/wayfarer/parsing/json.rb
Defined Under Namespace
Class Attribute Summary collapse
-
.registry ⇒ Hash
readonly
Mapping of Content-Type to parser.
Class Attribute Details
.registry ⇒ Hash (readonly)
Returns Mapping of Content-Type to parser.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/wayfarer/parsing.rb', line 7 module Parsing # @!visibility private FALLBACK_CONTENT_TYPE = "application/octet-stream" module_function # @!visibility private def parse(body, content_type = FALLBACK_CONTENT_TYPE) parser, args = Wayfarer.config.dig(:parsing, :content_types, content_type) return unless parser parser.parse(body, *args) end end |