fantasdic r373 - in trunk: . lib/fantasdic/sources



Author: mblondel
Date: Sun Jan  4 20:40:33 2009
New Revision: 373
URL: http://svn.gnome.org/viewvc/fantasdic?rev=373&view=rev

Log:
    * lib/fantasdic/sources/dictd_file.rb: Define and prefix search is now case
    insensitive.


Modified:
   trunk/ChangeLog
   trunk/lib/fantasdic/sources/dictd_file.rb

Modified: trunk/lib/fantasdic/sources/dictd_file.rb
==============================================================================
--- trunk/lib/fantasdic/sources/dictd_file.rb	(original)
+++ trunk/lib/fantasdic/sources/dictd_file.rb	Sun Jan  4 20:40:33 2009
@@ -107,14 +107,20 @@
          DictdIndex.b64_decode(word_len)]
     end
 
-    def match_exact(word)
+    def match_binary_search(word, &comp)
         binary_search_all(word) do |s1, s2|
+            comp.call(s1.downcase, s2.downcase)
+        end        
+    end
+
+    def match_exact(word)
+        match_binary_search(word) do |s1, s2|
             s1 <=> s2
         end
     end
 
     def match_prefix(word)
-        binary_search_all(word) do |s1, s2|
+        match_binary_search(word) do |s1, s2|
             if s1 =~ /^#{s2}/
                 0
             else



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]