[logaling-commit] logaling/logaling-command [master] improve check environment variable

Back to archive index

null+****@clear***** null+****@clear*****
Fri Mar 23 13:41:34 JST 2012


SUZUKI Miho	2012-03-23 13:41:34 +0900 (Fri, 23 Mar 2012)

  New Revision: 09d875fb4fae13fb4126d0cd7770d08a66c1df14

  Merged a5f7354: Merge pull request #56 from logaling/use-offline-index

  Log:
    improve check environment variable

  Modified files:
    lib/logaling/glossary_db.rb

  Modified: lib/logaling/glossary_db.rb (+10 -2)
===================================================================
--- lib/logaling/glossary_db.rb    2012-03-23 13:05:49 +0900 (80ad5e8)
+++ lib/logaling/glossary_db.rb    2012-03-23 13:41:34 +0900 (ffe7add)
@@ -69,7 +69,7 @@ module Logaling
     end
 
     def index_glossary(glossary, glossary_name, glossary_source, source_language, target_language, indexed_at)
-      delete_terms if ENV["LOGALING_OFFLINE_INDEX"] != "no"
+      delete_terms if offline_index?
 
       deindex_glossary(glossary_name, glossary_source)
 
@@ -82,7 +82,7 @@ module Logaling
         add_translation(glossary_name, glossary_source, source_language, target_language, source_term, target_term, note)
       end
 
-      create_terms if ENV["LOGALING_OFFLINE_INDEX"] != "no"
+      create_terms if offline_index?
     end
 
     def lookup(source_term, glossary_source=nil)
@@ -411,5 +411,13 @@ module Logaling
     def add_config(conf_key, conf_value)
       Groonga["configurations"].add(:conf_key => conf_key, :conf_value => conf_value)
     end
+
+    def offline_index?
+      if ENV["LOGALING_OFFLINE_INDEX"] != "no"
+        true
+      else
+        false
+      end
+    end
   end
 end




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