[logaling-commit] logaling/logaling-command [add-loga-copy] Extract Glossary#copy_from

Back to archive index

SHIMADA Koji null+****@clear*****
Thu Aug 16 18:31:03 JST 2012


SHIMADA Koji	2012-08-16 18:31:03 +0900 (Thu, 16 Aug 2012)

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

  Log:
    Extract Glossary#copy_from

  Modified files:
    lib/logaling/command/application.rb
    lib/logaling/glossary.rb

  Modified: lib/logaling/command/application.rb (+1 -4)
===================================================================
--- lib/logaling/command/application.rb    2012-08-16 18:22:51 +0900 (129334d)
+++ lib/logaling/command/application.rb    2012-08-16 18:31:03 +0900 (5cc420b)
@@ -367,10 +367,7 @@ module Logaling::Command
 
       project_new =****@repos*****_personal_project(new_project_name, new_source_language, new_target_language)
       glossary_new = project_new.glossary(new_source_language, new_target_language)
-      glossary_original.terms.each do |term|
-        glossary_new.add(term[:source_term], term[:target_term], term[:note])
-      end
-
+      glossary_new.copy_from(glossary_original)
     rescue Logaling::CommandFailed, Logaling::GlossaryAlreadyRegistered, Logaling::GlossaryNotFound => e
       say e.message
     end

  Modified: lib/logaling/glossary.rb (+6 -0)
===================================================================
--- lib/logaling/glossary.rb    2012-08-16 18:22:51 +0900 (c301518)
+++ lib/logaling/glossary.rb    2012-08-16 18:31:03 +0900 (3681201)
@@ -75,6 +75,12 @@ module Logaling
       end
     end
 
+    def copy_from(glossary)
+      glossary.terms.each do |term|
+        add(term[:source_term], term[:target_term], term[:note])
+      end
+    end
+
     def initialize_glossary_source
       glossary_source.initialize_source
     end
-------------- next part --------------
An HTML attachment was scrubbed...
Télécharger 



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