sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 3ad5a89a038be9d2cce6a8fc3449b26aa249254e
parent f58afc1c9fa077e057b1e4a31dec65195dda51b8
Author: Rich Lane <rlane@club.cc.cmu.edu>
Date:   Thu, 31 Dec 2009 13:22:39 -0800

xapian: replace DocumentMethods module with plain monkeypatching

Conflicts:

	lib/sup/xapian_index.rb

Diffstat:
M lib/sup/xapian_index.rb | 47 ++++++++++++++++++++++-------------------------
1 file changed, 22 insertions(+), 25 deletions(-)
diff --git a/lib/sup/xapian_index.rb b/lib/sup/xapian_index.rb
@@ -565,35 +565,32 @@ EOS
       raise "Invalid term type #{type}"
     end
   end
+end
 
-  module DocumentMethods
-    def entry
-      Marshal.load data
-    end
-
-    def entry=(x)
-      self.data = Marshal.dump x
-    end
+end
 
-    def index_text text, prefix, weight=1
-      term_generator = Xapian::TermGenerator.new
-      term_generator.stemmer = Xapian::Stem.new(STEM_LANGUAGE)
-      term_generator.document = self
-      term_generator.index_text text, weight, prefix
-    end
+class Xapian::Document
+  def entry
+    Marshal.load data
+  end
 
-    def add_term term
-      if term.length <= MAX_TERM_LENGTH
-        super term
-      else
-        warn "dropping excessively long term #{term}"
-      end
-    end
+  def entry=(x)
+    self.data = Marshal.dump x
   end
-end
 
-end
+  def index_text text, prefix, weight=1
+    term_generator = Xapian::TermGenerator.new
+    term_generator.stemmer = Xapian::Stem.new(Redwood::XapianIndex::STEM_LANGUAGE)
+    term_generator.document = self
+    term_generator.index_text text, weight, prefix
+  end
 
-class Xapian::Document
-  include Redwood::XapianIndex::DocumentMethods
+  alias old_add_term add_term
+  def add_term term
+    if term.length <= Redwood::XapianIndex::MAX_TERM_LENGTH
+      old_add_term term
+    else
+      warn "dropping excessively long term #{term}"
+    end
+  end
 end