[logaling-commit] logaling/logaling-command [add-project-to-glossary-from-db] Extract Project#type

Back to archive index

SUZUKI Miho null+****@clear*****
Fri Nov 9 13:53:11 JST 2012


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

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

  Log:
    Extract Project#type

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

  Modified: lib/logaling/glossary_db.rb (+1 -2)
===================================================================
--- lib/logaling/glossary_db.rb    2012-11-07 23:53:03 +0900 (3fc9f73)
+++ lib/logaling/glossary_db.rb    2012-11-09 13:53:11 +0900 (8057c78)
@@ -265,11 +265,10 @@ module Logaling
     end
 
     def add_glossary_source(glossary_source)
-      project_type = glossary_source.glossary.project.class.to_s.sub('Logaling::','')
       Groonga["glossary_sources"].add(
         glossary_source.source_path, {
         :indexed_at => glossary_source.mtime,
-        :project_type => project_type})
+        :project_type => glossary_source.glossary.project.type})
     end
 
     def delete_glossary(glossary_name)

  Modified: lib/logaling/project.rb (+4 -0)
===================================================================
--- lib/logaling/project.rb    2012-11-07 23:53:03 +0900 (82081de)
+++ lib/logaling/project.rb    2012-11-09 13:53:11 +0900 (bc10377)
@@ -96,6 +96,10 @@ module Logaling
       true
     end
 
+    def type
+      self.class.to_s.sub('Logaling::','')
+    end
+
     private
     def all_glossary_source_path
       Dir.glob(File.join(glossary_source_path, "*"))
-------------- next part --------------
An HTML attachment was scrubbed...
Télécharger 



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