[logaling-commit] logaling/logaling-command [master] Override Project#has_glossary? instead of #all_glossary_source_path

Back to archive index

SHIMADA Koji null+****@clear*****
Wed Nov 21 15:19:26 JST 2012


SHIMADA Koji	2012-11-21 15:19:26 +0900 (Wed, 21 Nov 2012)

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

  Merged 6a87d99: Merge pull request #90 from logaling/change-glossarysourcepath-fullpath-to-relativepath

  Log:
    Override Project#has_glossary? instead of #all_glossary_source_path

  Modified files:
    lib/logaling/project.rb

  Modified: lib/logaling/project.rb (+10 -10)
===================================================================
--- lib/logaling/project.rb    2012-11-21 14:52:31 +0900 (ec9fa7f)
+++ lib/logaling/project.rb    2012-11-21 15:19:26 +0900 (a5f5a0c)
@@ -128,6 +128,11 @@ module Logaling
       [GlossarySource.create(@path, glossary(source_language, target_language))]
     end
 
+    def has_glossary?(source_language, target_language)
+      glossary_source_language, glossary_target_language = File.basename(@path).split(/\./)[1..2]
+      glossary_source_language == source_language && glossary_target_language == target_language
+    end
+
     def glossary_source_path
       @repository.expand_path(@path)
     end
@@ -143,11 +148,6 @@ module Logaling
     def source_directory_path
       File.dirname(glossary_source_path)
     end
-
-    private
-    def all_glossary_source_path
-      Dir.glob(File.join(File.dirname(glossary_source_path), "*"))
-    end
   end
 
   class PersonalProject < Project
@@ -178,6 +178,11 @@ module Logaling
       [GlossarySource.create(@path, glossary(source_language, target_language))]
     end
 
+    def has_glossary?(source_language, target_language)
+      glossary_source_language, glossary_target_language = File.basename(@path).split(/\./)[1..2]
+      glossary_source_language == source_language && glossary_target_language == target_language
+    end
+
     def expand_path
       @repository.expand_path(@path)
     end
@@ -198,10 +203,5 @@ module Logaling
     def source_directory_path
       File.dirname(glossary_source_path)
     end
-
-    private
-    def all_glossary_source_path
-      Dir.glob(File.join(File.dirname(glossary_source_path), "*"))
-    end
   end
 end
-------------- next part --------------
An HTML attachment was scrubbed...
下載 



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