[logaling-commit] logaling/logaling-command [master] Extract Glossary#get_bilingual_pair

Zurück zum Archiv-Index

SHIMADA Koji null+****@clear*****
Thu Sep 20 17:44:54 JST 2012


SHIMADA Koji	2012-09-20 17:44:54 +0900 (Thu, 20 Sep 2012)

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

  Log:
    Extract Glossary#get_bilingual_pair

  Modified files:
    lib/logaling/glossary.rb

  Modified: lib/logaling/glossary.rb (+6 -2)
===================================================================
--- lib/logaling/glossary.rb    2012-09-20 17:07:59 +0900 (0b19a19)
+++ lib/logaling/glossary.rb    2012-09-20 17:44:54 +0900 (6979b60)
@@ -39,14 +39,18 @@ module Logaling
       terms
     end
 
-    def bilingual_pair_exists?(source_term, target_term, note=nil)
+    def get_bilingual_pair(source_term, target_term, note=nil)
       raise Logaling::GlossaryDBNotFound unless File.exist?(@project.glossary_db_path)
       index
       terms = []
       Logaling::GlossaryDB.open(@project.glossary_db_path, "utf8") do |db|
         terms = db.get_bilingual_pair(source_term, target_term, @name, note)
       end
-      !terms.delete_if {|t| t[:target_language] != @target_language.to_sym }.empty?
+      terms.delete_if {|t| t[:target_language] != @target_language }
+    end
+
+    def bilingual_pair_exists?(source_term, target_term, note=nil)
+      !get_bilingual_pair(source_term, target_term, note).empty?
     end
 
     def add(source_term, target_term, note)
-------------- next part --------------
An HTML attachment was scrubbed...
Download 



More information about the logaling-commit mailing list
Zurück zum Archiv-Index