[logaling-commit] logaling/logaling-command [master] Use GlossaryDB#deindex_glossary_source when deindexing glossary_source

Back to archive index

null+****@clear***** null+****@clear*****
Mon Jun 18 12:41:19 JST 2012


SUZUKI Miho	2012-06-18 12:41:19 +0900 (Mon, 18 Jun 2012)

  New Revision: 05b8fde85873ac095ba8d549b625dce9bd63bc25
  https://github.com/logaling/logaling-command/commit/05b8fde85873ac095ba8d549b625dce9bd63bc25

  Merged 7228757: Merge pull request #60 from logaling/refactor-structure

  Log:
    Use GlossaryDB#deindex_glossary_source when deindexing glossary_source

  Modified files:
    lib/logaling/glossary.rb
    lib/logaling/glossary_db.rb
    lib/logaling/glossary_source.rb

  Modified: lib/logaling/glossary.rb (+2 -2)
===================================================================
--- lib/logaling/glossary.rb    2012-06-18 12:04:45 +0900 (427563e)
+++ lib/logaling/glossary.rb    2012-06-18 12:41:19 +0900 (691fe4f)
@@ -90,9 +90,9 @@ module Logaling
           end
         end
         indexed_glossary_sources = db.glossary_sources_related_on_glossary(self)
-        (indexed_glossary_sources - glossary_sources.map(&:source_path)).each do |removed_glossary_source|
+        (indexed_glossary_sources - glossary_sources).each do |removed_glossary_source|
           puts "now deindex #{@name}..."
-          db.deindex_glossary(@name, removed_glossary_source)
+          db.deindex_glossary_source(removed_glossary_source)
         end
       end
     end

  Modified: lib/logaling/glossary_db.rb (+1 -1)
===================================================================
--- lib/logaling/glossary_db.rb    2012-06-18 12:04:45 +0900 (edfaf7e)
+++ lib/logaling/glossary_db.rb    2012-06-18 12:41:19 +0900 (506013c)
@@ -238,7 +238,7 @@ module Logaling
       records = Groonga["glossary_sources"].select do |record|
         [record.key =~ glossary.to_s]
       end
-      records.map{|record| record.key.key }
+      records.map{|record| GlossarySource.new(record.key.key, glossary) }
     end
 
     def get_all_glossary

  Modified: lib/logaling/glossary_source.rb (+9 -0)
===================================================================
--- lib/logaling/glossary_source.rb    2012-06-18 12:04:45 +0900 (16ce7fa)
+++ lib/logaling/glossary_source.rb    2012-06-18 12:41:19 +0900 (08d11dd)
@@ -128,6 +128,15 @@ module Logaling
       GlossarySource.load_glossary_source(@source_path)
     end
 
+    def eql?(other)
+      return false unless self.class == other.class
+      @source_path == other.source_path
+    end
+
+    def hash
+      @source_path.hash
+    end
+
     def mtime
       File.mtime(@source_path)
     end
-------------- next part --------------
An HTML attachment was scrubbed...
다운로드 



More information about the logaling-commit mailing list
Back to archive index