aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--lib/csv.rb6
2 files changed, 8 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index b17e23f2e0..8c9eca458f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Sep 23 23:39:25 2008 James Edward Gray II <jeg2@ruby-lang.org>
+
+ * lib/csv/csv.rb: Improved the idea of whitespace and word characters used
+ in substitutions during header conversion as suggested by Michael Selig.
+
Tue Sep 23 21:50:53 2008 Tanaka Akira <akr@fsij.org>
* io.c (io_binwrite): allocate wbuf if nosync.
diff --git a/lib/csv.rb b/lib/csv.rb
index dccee6cbe8..ccfa6ab42f 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
}
}