diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-08-22 05:32:34 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-08-22 05:32:34 +0000 |
commit | 2c69f7b278b782b2243fd9eec71264d4d7cab78c (patch) | |
tree | 408065d4cf1d5ca53928c93f88c729c72ed09213 /lib | |
parent | 84bc175cab620279d22ccf560685d7d0b79e9f00 (diff) | |
download | ruby-2c69f7b278b782b2243fd9eec71264d4d7cab78c.tar.gz |
Escape skip_lines string before convert to Regexp.
It ignored all of lines when given Regexp special characters.
[Feature #9147][ruby-core:58549]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/csv.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/csv.rb b/lib/csv.rb index de056d46f6..25f2bf35e6 100644 --- a/lib/csv.rb +++ b/lib/csv.rb @@ -2159,7 +2159,7 @@ class CSV # See also CSV.new def init_comments(skip_lines) @skip_lines = skip_lines - @skip_lines = Regexp.new(@skip_lines) if @skip_lines.is_a? String + @skip_lines = Regexp.new(Regexp.escape(@skip_lines)) if @skip_lines.is_a? String if @skip_lines and not @skip_lines.respond_to?(:match) raise ArgumentError, ":skip_lines has to respond to matches" end |