null+****@clear*****
null+****@clear*****
Tue Jun 19 19:00:33 JST 2012
SUZUKI Miho 2012-06-19 19:00:33 +0900 (Tue, 19 Jun 2012) New Revision: 19b87d90dfcc17519b087b1bd15cf667d330a5fe https://github.com/logaling/logaling-command/commit/19b87d90dfcc17519b087b1bd15cf667d330a5fe Log: Change parameter to Glossary and GlossarySource object Modified files: lib/logaling/glossary_db.rb lib/logaling/repository.rb Modified: lib/logaling/glossary_db.rb (+10 -10) =================================================================== --- lib/logaling/glossary_db.rb 2012-06-19 17:46:53 +0900 (506013c) +++ lib/logaling/glossary_db.rb 2012-06-19 19:00:33 +0900 (7e21073) @@ -61,10 +61,10 @@ module Logaling @database = nil end - def deindex_glossary(glossary_name, glossary_source) - delete_translations_by_glossary_source(glossary_source) - delete_glossary(glossary_name) - delete_glossary_source(glossary_source) + def deindex_glossary(glossary, glossary_source) + delete_translations_by_glossary_source(glossary_source.source_path) + delete_glossary(glossary.name) + delete_glossary_source(glossary_source.source_path) end def deindex_glossary_source(glossary_source) @@ -89,18 +89,18 @@ module Logaling create_terms if offline_index? end - def index_glossary(glossary_name, glossary_source, source_language, target_language) + def index_glossary(glossary, glossary_source) delete_terms if offline_index? - deindex_glossary(glossary_name, glossary_source) + deindex_glossary(glossary, glossary_source) - add_glossary_source(glossary_source, File.mtime(glossary_source)) - add_glossary(glossary_name) - GlossarySource.load(glossary_source).each do |term| + add_glossary_source(glossary_source.source_path, glossary_source.mtime) + add_glossary(glossary.name) + GlossarySource.load(glossary_source.source_path).each do |term| source_term = term['source_term'] target_term = term['target_term'] note = term['note'] - add_translation(glossary_name, glossary_source, source_language, target_language, source_term, target_term, note) + add_translation(glossary.name, glossary_source.source_path, glossary.source_language, glossary.target_language, source_term, target_term, note) end create_terms if offline_index? Modified: lib/logaling/repository.rb (+2 -2) =================================================================== --- lib/logaling/repository.rb 2012-06-19 17:46:53 +0900 (f7f42be) +++ lib/logaling/repository.rb 2012-06-19 19:00:33 +0900 (e0038cb) @@ -98,7 +98,7 @@ module Logaling glossary = glossary_source.glossary unless db.glossary_source_exist?(glossary_source.source_path, indexed_at) puts "now index #{glossary.name}..." - db.index_glossary(glossary.name, glossary_source.source_path, glossary.source_language, glossary.target_language) + db.index_glossary(glossary, glossary_source) end end (db.get_all_glossary_source - all_glossaries.map(&:source_path)).each do |glossary_source_path| @@ -106,7 +106,7 @@ module Logaling glossary = Logaling::Glossary.new(glossary_name, source_language, target_language) glossary_source = Logaling::GlossarySource.new(glossary_source_path, glossary) puts "now deindex #{glossary.name}..." - db.deindex_glossary(glossary.name, glossary_source.source_path) + db.deindex_glossary(glossary, glossary_source) end end end -------------- next part -------------- An HTML attachment was scrubbed... 다운로드