[logaling-commit] logaling/logaling-command [master] Extract Project#same? and Glossary#same?

アーカイブの一覧に戻る

SUZUKI Miho null+****@clear*****
Fri Nov 9 14:17:53 JST 2012


SUZUKI Miho	2012-11-09 14:17:53 +0900 (Fri, 09 Nov 2012)

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

  Merged b3533fc: Merge pull request #89 from logaling/add-project-to-glossary-from-db

  Log:
    Extract Project#same? and Glossary#same?

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

  Modified: lib/logaling/glossary.rb (+4 -0)
===================================================================
--- lib/logaling/glossary.rb    2012-11-09 13:58:03 +0900 (e6419cd)
+++ lib/logaling/glossary.rb    2012-11-09 14:17:53 +0900 (1bba103)
@@ -126,6 +126,10 @@ module Logaling
       end
     end
 
+    def same?(glossary)
+      name == glossary.name
+    end
+
     private
     def glossary_sources
       glob_condition = SUPPORTED_FILE_TYPE.map do |type|

  Modified: lib/logaling/glossary_db.rb (+3 -3)
===================================================================
--- lib/logaling/glossary_db.rb    2012-11-09 13:58:03 +0900 (8057c78)
+++ lib/logaling/glossary_db.rb    2012-11-09 14:17:53 +0900 (444e3c4)
@@ -453,13 +453,13 @@ module Logaling
       get_all_glossary_sources.each do |glossary_source_taken|
         project_taken = glossary_source_taken.glossary.project
         if project.personal? && project_taken.personal?
-          if glossary_source.glossary.name == glossary_source_taken.glossary.name
+          if glossary_source.glossary.same?(glossary_source_taken.glossary)
             glossary_source_num = 1
             break
           end
         elsif project.normal_project? && project_taken.normal_project?
-          if project.name == project_taken.name &&
-             glossary_source.glossary.name == glossary_source_taken.glossary.name
+          if project.same?(project_taken) &&
+             glossary_source.glossary.same?(glossary_source_taken.glossary)
             glossary_source_num = 1
             break
           end

  Modified: lib/logaling/project.rb (+4 -0)
===================================================================
--- lib/logaling/project.rb    2012-11-09 13:58:03 +0900 (1257ace)
+++ lib/logaling/project.rb    2012-11-09 14:17:53 +0900 (f684a22)
@@ -100,6 +100,10 @@ module Logaling
       self.class.to_s.sub('Logaling::', '')
     end
 
+    def same?(project)
+      name == project.name
+    end
+
     private
     def all_glossary_source_path
       Dir.glob(File.join(glossary_source_path, "*"))
-------------- next part --------------
An HTML attachment was scrubbed...
ダウンロード 



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