[logaling-commit] logaling/logaling-command [master] Change GlossaryDB#glossary_sources_related_on_glossary to return list of GlossarySource

Back to archive index

null+****@clear***** null+****@clear*****
Tue Jun 19 19:38:58 JST 2012


SUZUKI Miho	2012-06-19 19:38:58 +0900 (Tue, 19 Jun 2012)

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

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

  Log:
    Change GlossaryDB#glossary_sources_related_on_glossary to return list of GlossarySource

  Modified files:
    lib/logaling/glossary_db.rb
    lib/logaling/repository.rb

  Modified: lib/logaling/glossary_db.rb (+6 -1)
===================================================================
--- lib/logaling/glossary_db.rb    2012-06-19 19:23:39 +0900 (542412b)
+++ lib/logaling/glossary_db.rb    2012-06-19 19:38:58 +0900 (bd87624)
@@ -229,9 +229,14 @@ module Logaling
     end
 
     def get_all_glossary_source
-      Groonga["glossary_sources"].sort([
+      source_paths = Groonga["glossary_sources"].sort([
         {:key=>"_key", :order=>'ascending'}
       ]).map{|record| record.key}
+      source_paths.map do |source_path|
+        glossary_name, source_language, target_language = File.basename(source_path).split(/\./)
+        glossary = Glossary.new(glossary_name, source_language, target_language)
+        GlossarySource.new(source_path, glossary)
+      end
     end
 
     def glossary_sources_related_on_glossary(glossary)

  Modified: lib/logaling/repository.rb (+2 -4)
===================================================================
--- lib/logaling/repository.rb    2012-06-19 19:23:39 +0900 (50b5faa)
+++ lib/logaling/repository.rb    2012-06-19 19:38:58 +0900 (40b7387)
@@ -100,10 +100,8 @@ module Logaling
             db.index_glossary(glossary, glossary_source)
           end
         end
-        (db.get_all_glossary_source - all_glossary_sources.map(&:source_path)).each do |glossary_source_path|
-          glossary_name, source_language, target_language = get_glossary(glossary_source_path)
-          glossary = Logaling::Glossary.new(glossary_name, source_language, target_language)
-          glossary_source = Logaling::GlossarySource.new(glossary_source_path, glossary)
+        (db.get_all_glossary_source - all_glossary_sources).each do |glossary_source|
+          glossary = glossary_source.glossary
           puts "now deindex #{glossary.name}..."
           db.deindex_glossary(glossary, glossary_source)
         end
-------------- next part --------------
An HTML attachment was scrubbed...
다운로드 



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