[logaling-commit] logaling/logaling-command [loga-new-no-project] Extract Project#has_glossary? method

アーカイブの一覧に戻る

SHIMADA Koji null+****@clear*****
Mon Aug 13 11:14:26 JST 2012


SHIMADA Koji	2012-08-13 11:14:26 +0900 (Mon, 13 Aug 2012)

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

  Log:
    Extract Project#has_glossary? method

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

  Modified: lib/logaling/project.rb (+4 -0)
===================================================================
--- lib/logaling/project.rb    2012-08-13 11:06:12 +0900 (f646757)
+++ lib/logaling/project.rb    2012-08-13 11:14:26 +0900 (877bfdb)
@@ -72,6 +72,10 @@ module Logaling
       end
     end
 
+    def has_glossary?(source_language, target_language)
+      glossaries.map(&:to_s).index([name, source_language, target_language].join('.'))
+    end
+
     private
     def all_glossary_source_path
       Dir.glob(File.join(glossary_source_path, "*"))

  Modified: lib/logaling/repository.rb (+1 -1)
===================================================================
--- lib/logaling/repository.rb    2012-08-13 11:06:12 +0900 (f0db47e)
+++ lib/logaling/repository.rb    2012-08-13 11:14:26 +0900 (677c9e1)
@@ -166,7 +166,7 @@ module Logaling
 
     def glossary_exists?(glossary_name, source_language, target_language)
       project = find_project(glossary_name)
-      if project && project.glossaries.map(&:to_s).index([glossary_name, source_language, target_language].join('.'))
+      if project && project.has_glossary?(source_language, target_language)
         true
       else
         false
-------------- next part --------------
An HTML attachment was scrubbed...
ダウンロード 



More information about the logaling-commit mailing list
アーカイブの一覧に戻る