]> git.cworth.org Git - sup/commitdiff
add Message.indexable_{body, chunks, subject}
authorRich Lane <rlane@club.cc.cmu.edu>
Sat, 20 Jun 2009 20:50:12 +0000 (13:50 -0700)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Wed, 24 Jun 2009 13:44:48 +0000 (09:44 -0400)
lib/sup/message.rb

index 8a09ac8271b2fcf2240d8b8238d0d694ecc4b01c..7c6374651e379ea0947caf7072390bba6d981eb3 100644 (file)
@@ -270,11 +270,23 @@ EOS
       to.map { |p| p.indexable_content },
       cc.map { |p| p.indexable_content },
       bcc.map { |p| p.indexable_content },
-      chunks.select { |c| c.is_a? Chunk::Text }.map { |c| c.lines },
-      Message.normalize_subj(subj),
+      indexable_chunks.map { |c| c.lines },
+      indexable_subject,
     ].flatten.compact.join " "
   end
 
+  def indexable_body
+    indexable_chunks.map { |c| c.lines }.flatten.compact.join " "
+  end
+
+  def indexable_chunks
+    chunks.select { |c| c.is_a? Chunk::Text }
+  end
+
+  def indexable_subject
+    Message.normalize_subj(subj)
+  end
+
   def quotable_body_lines
     chunks.find_all { |c| c.quotable? }.map { |c| c.lines }.flatten
   end