]> git.cworth.org Git - sup/commitdiff
bugfix: further fixing of split usage
authorWilliam Morgan <wmorgan-sup@masanjin.net>
Wed, 13 May 2009 20:08:51 +0000 (13:08 -0700)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Wed, 13 May 2009 20:43:01 +0000 (13:43 -0700)
Clean up a couple remaining non-optimal uses of String#split.

lib/sup/index.rb

index 2bdf22b0c2b2ea22f904cc349672a1fe69fc20ad..853bf7603556df49e97d6926eb9969cf4187168e 100644 (file)
@@ -333,7 +333,7 @@ EOS
 
       q = Ferret::Search::BooleanQuery.new true
       sq = Ferret::Search::PhraseQuery.new(:subject)
-      wrap_subj(Message.normalize_subj(m.subj)).split(/\s+/).each do |t|
+      wrap_subj(Message.normalize_subj(m.subj)).split.each do |t|
         sq.add_term t
       end
       q.add_query sq, :must
@@ -378,7 +378,7 @@ EOS
           unless messages.member?(mid)
             #Redwood::log "got #{mid} as a child of #{id}"
             messages[mid] ||= lambda { build_message docid }
-            refs = @index[docid][:refs].split(" ")
+            refs = @index[docid][:refs].split
             pending += refs.select { |id| !searched[id] }
           end
         end
@@ -409,9 +409,9 @@ EOS
         "date" => Time.at(doc[:date].to_i),
         "subject" => unwrap_subj(doc[:subject]),
         "from" => doc[:from],
-        "to" => doc[:to].split(/\s+/).join(", "), # reformat
+        "to" => doc[:to].split.join(", "), # reformat
         "message-id" => doc[:message_id],
-        "references" => doc[:refs].split(/\s+/).map { |x| "<#{x}>" }.join(" "),
+        "references" => doc[:refs].split.map { |x| "<#{x}>" }.join(" "),
       }
 
       Message.new :source => source, :source_info => doc[:source_info].to_i,