class Response::CSV

Public Class Methods

new(app = nil, options = {}) click to toggle source
Calls superclass method
# File lib/faraday/response/csv.rb, line 13
def initialize(app = nil, options = {})
  super(app, options)
  @parser_options = options[:parser_options] || {}
end

Public Instance Methods

parse(body) click to toggle source

Parse the response body.

# File lib/faraday/response/csv.rb, line 19
def parse(body)
  if self.class.parser
    begin
      self.class.parser.call(body, @parser_options)
    rescue StandardError, SyntaxError => err
      raise err if err.is_a? SyntaxError and err.class.name != 'Psych::SyntaxError'
      raise Faraday::Error::ParsingError, err
    end
  else
    body
  end
end