summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorjeg2 <jeg2@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-23 14:40:24 +0000
committerjeg2 <jeg2@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-23 14:40:24 +0000
commit752311d5885a3e93f2f84c10dea6f393475b14fe (patch)
treef78cdbc041ea221da552ac35dece49646f4d5e23 /lib
parentdb8438453645d50137eb8e024260e0fd27b2b509 (diff)
downloadruby-752311d5885a3e93f2f84c10dea6f393475b14fe.tar.gz
ruby-752311d5885a3e93f2f84c10dea6f393475b14fe.tar.xz
ruby-752311d5885a3e93f2f84c10dea6f393475b14fe.zip
* lib/csv/csv.rb: Improved the idea of whitespace and word characters used
in substitutions during header conversion as suggested by Michael Selig. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/csv.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/csv.rb b/lib/csv.rb
index dccee6cbe..ccfa6ab42 100644
--- a/lib/csv.rb
+++ b/lib/csv.rb
@@ -199,7 +199,7 @@ require "stringio"
#
class CSV
# The version of the installed library.
- VERSION = "2.4.0".freeze
+ VERSION = "2.4.1".freeze
#
# A CSV::Row is part Array and part Hash. It retains an order for the fields
@@ -933,8 +933,8 @@ class CSV
HeaderConverters = {
:downcase => lambda { |h| h.encode(ConverterEncoding).downcase },
:symbol => lambda { |h|
- h.encode(ConverterEncoding).
- downcase.tr(" ", "_").delete("^a-z0-9_").to_sym
+ h.encode(ConverterEncoding).downcase.gsub(/\s+/, "_").
+ gsub(/\W+/, "").to_sym
}
}