Module: Peddler::Parser Private

Defined in:
lib/peddler/parser.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Class Method Summary collapse

Class Method Details

.parse(res) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/peddler/parser.rb', line 7

def self.parse(res)
  # Don't parse if there's no body
  return res unless res.body

  case res.headers['Content-Type']
  when 'text/xml'
    XMLParser.new(res)
  when 'application/octet-stream'
    CSVParser.new(res)
  else
    raise NotImplementedError
  end
end