Module: Aitch::ResponseParser
- Defined in:
- lib/aitch/response_parser.rb,
lib/aitch/response_parser/xml_parser.rb,
lib/aitch/response_parser/html_parser.rb,
lib/aitch/response_parser/json_parser.rb,
lib/aitch/response_parser/default_parser.rb
Defined Under Namespace
Modules: DefaultParser, HTMLParser, JSONParser, XMLParser
Class Method Summary
collapse
Class Method Details
.append(name, parser) ⇒ Object
14
15
16
17
|
# File 'lib/aitch/response_parser.rb', line 14
def self.append(name, parser)
unregister(name)
parsers << parser
end
|
.find(content_type) ⇒ Object
23
24
25
|
# File 'lib/aitch/response_parser.rb', line 23
def self.find(content_type)
parsers.find {|parser| parser.match?(content_type) }
end
|
5
6
7
|
# File 'lib/aitch/response_parser.rb', line 5
def self.parsers
@parsers ||= []
end
|
.prepend(name, parser) ⇒ Object
9
10
11
12
|
# File 'lib/aitch/response_parser.rb', line 9
def self.prepend(name, parser)
unregister(name)
parsers.unshift parser
end
|
.unregister(name) ⇒ Object
19
20
21
|
# File 'lib/aitch/response_parser.rb', line 19
def self.unregister(name)
parsers.delete_if {|parser| parser.type == name }
end
|