Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
If skip_lines is set to a String, convert it to a Regexp #455
This pull request fixes the issue I described in: https://bugs.ruby-lang.org/issues/8560
Basically, skip_lines takes any object that responds to match and passes in each line of the csv as an argument to match. But when skip_lines is a string, string#match converts it's argument to a Regexp. In our case, that argument is each line in the CSV. So each line gets converted to a Regexp one at a time.
It is very unexpected behavior for each line in the CSV to act as a Regexp. And in many cases, it will cause an error similar to:
Forced to make the choice between converting skip_lines to a Regexp if it's a String and converting each line in the CSV to a Regexp, I've chosen the former.