Sha256: 0cb280eba9379911013859c4f49e9b23db69bb9f7781683f024490d79e2af2cd
Contents?: true
Size: 631 Bytes
Versions: 5
Compression:
Stored size: 631 Bytes
Contents
# frozen_string_literal: true module Aitch module ResponseParser def self.parsers @parsers ||= [] end def self.prepend(name, parser) unregister(name) parsers.unshift parser end def self.append(name, parser) unregister(name) parsers << parser end def self.unregister(name) parsers.delete_if {|parser| parser.type == name } end def self.find(content_type) parsers.find {|parser| parser.match?(content_type) } end append :json, JSONParser append :xml, XMLParser append :html, HTMLParser append :default, DefaultParser end end
Version data entries
5 entries across 5 versions & 1 rubygems