[前][次][番号順一覧][スレッド一覧]

ruby-changes:7971

From: jeg2 <ko1@a...>
Date: Tue, 23 Sep 2008 23:40:43 +0900 (JST)
Subject: [ruby-changes:7971] Ruby:r19494 (trunk): * lib/csv/csv.rb: Improved the idea of whitespace and word characters used

jeg2	2008-09-23 23:40:24 +0900 (Tue, 23 Sep 2008)

  New Revision: 19494

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19494

  Log:
    * lib/csv/csv.rb:  Improved the idea of whitespace and word characters used
      in substitutions during header conversion as suggested by Michael Selig.

  Modified files:
    trunk/ChangeLog
    trunk/lib/csv.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 19493)
+++ ChangeLog	(revision 19494)
@@ -1,3 +1,8 @@
+Tue Sep 23 23:39:25 2008  James Edward Gray II  <jeg2@r...>
+
+	* 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@f...>
 
 	* io.c (io_binwrite): allocate wbuf if nosync.
Index: lib/csv.rb
===================================================================
--- lib/csv.rb	(revision 19493)
+++ lib/csv.rb	(revision 19494)
@@ -199,7 +199,7 @@
 # 
 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 @@
   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
     }
   }
   

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]