Note: Don’t use this class directly. This is an internal class.
Namespace
- CLASS CSV::Parser::InputsScanner
- CLASS CSV::Parser::InvalidEncoding
- CLASS CSV::Parser::Scanner
- CLASS CSV::Parser::UnexpectedError
Methods
- C
- F
- H
- L
- M
- N
- P
- Q
- R
- S
- U
Constants
SCANNER_TEST | = | (ENV["CSV_PARSER_SCANNER_TEST"] == "yes") |
SCANNER_TEST_CHUNK_SIZE_NAME | = | "CSV_PARSER_SCANNER_TEST_CHUNK_SIZE" |
SCANNER_TEST_CHUNK_SIZE_VALUE | = | ENV[SCANNER_TEST_CHUNK_SIZE_NAME] |
STRING_SCANNER_SCAN_ACCEPT_STRING | = | false |
Class Public methods
new(input, options) Link
Instance Public methods
column_separator() Link
field_size_limit() Link
header_row?() Link
headers() Link
liberal_parsing?() Link
lineno() Link
max_field_size() Link
parse(&block) Link
# File ruby/lib/csv/parser.rb, line 390 def parse(&block) return to_enum(__method__) unless block_given? if @return_headers and @headers and @raw_headers headers = Row.new(@headers, @raw_headers, true) if @unconverted_fields headers = add_unconverted_fields(headers, []) end yield headers end begin @scanner ||= build_scanner if quote_character.nil? parse_no_quote(&block) elsif @need_robust_parsing parse_quotable_robust(&block) else parse_quotable_loose(&block) end rescue InvalidEncoding if @scanner ignore_broken_line lineno = @lineno else lineno = @lineno + 1 end raise InvalidEncodingError.new(@encoding, lineno) rescue UnexpectedError => error if @scanner ignore_broken_line lineno = @lineno else lineno = @lineno + 1 end message = "This should not be happen: #{error.message}: " message += "Please report this to https://github.com/ruby/csv/issues" raise MalformedCSVError.new(message, lineno) end end