End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
CSV::Parser#validate_strip_and_col_sep_options
validate_strip_and_col_sep_options
lib/csv/parser.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.1.3/lib/csv/parser.rb, line 618
def validate_strip_and_col_sep_options
return unless @strip
if @strip.is_a?(String)
if @column_separator.start_with?(@strip) || @column_separator.end_with?(@strip)
raise ArgumentError,
"The provided strip (#{@escaped_strip}) and " \
"col_sep (#{@escaped_column_separator}) options are incompatible."
end
else
if Regexp.new("\\A[#{@escaped_strip}]|[#{@escaped_strip}]\\z").match?(@column_separator)
raise ArgumentError,
"The provided strip (true) and " \
"col_sep (#{@escaped_column_separator}) options are incompatible."
end
end
end
This method verifies that there are no (obvious) ambiguities with the provided col_sep and strip parsing options. For example, if col_sep and strip were both equal to +\t+, then there would be no clear way to parse the input.