SUZUKI Miho
null+****@clear*****
Mon Oct 29 11:15:53 JST 2012
SUZUKI Miho 2012-10-12 11:30:24 +0900 (Fri, 12 Oct 2012) New Revision: fbc41b1c2b899caca18a717adb49716b52632fac https://github.com/logaling/logaling-command/commit/fbc41b1c2b899caca18a717adb49716b52632fac Merged fb2d86e: Merge pull request #85 from logaling/add-no-annotation-option Log: Use hash as argument Modified files: lib/logaling/command/application.rb lib/logaling/repository.rb spec/logaling/repository_spec.rb Modified: lib/logaling/command/application.rb (+1 -1) =================================================================== --- lib/logaling/command/application.rb 2012-10-12 11:13:05 +0900 (b9b8234) +++ lib/logaling/command/application.rb 2012-10-12 11:30:24 +0900 (b147d2e) @@ -273,7 +273,7 @@ module Logaling::Command else glossary = nil end - terms =****@repos*****(source_term, glossary, options["dictionary"], options["no-annotation"]) + terms =****@repos*****(source_term, glossary, options) unless terms.empty? run_pager terms.each_with_index do |term, i| Modified: lib/logaling/repository.rb (+3 -3) =================================================================== --- lib/logaling/repository.rb 2012-10-12 11:13:05 +0900 (1d0efbd) +++ lib/logaling/repository.rb 2012-10-12 11:30:24 +0900 (eb056c2) @@ -82,18 +82,18 @@ module Logaling raise Logaling::CommandFailed, "Failed import_tmx #{glossary_source.class.name} to #{cache_path}." end - def lookup(source_term, glossary, dictionary=false, no_annotation=false) + def lookup(source_term, glossary, options={}) raise Logaling::GlossaryDBNotFound unless File.exist?(logaling_db_home) terms = [] Logaling::GlossaryDB.open(logaling_db_home, "utf8") do |db| - if dictionary + if options['dictionary'] terms = db.lookup_dictionary(source_term) else terms = db.lookup(source_term, glossary) end end - no_annotation ? except_annotation(terms) : terms + options['no-annotation'] ? except_annotation(terms) : terms end def except_annotation(terms) Modified: spec/logaling/repository_spec.rb (+4 -2) =================================================================== --- spec/logaling/repository_spec.rb 2012-10-12 11:13:05 +0900 (0c3447a) +++ spec/logaling/repository_spec.rb 2012-10-12 11:30:24 +0900 (e6c80f1) @@ -54,7 +54,8 @@ module Logaling glossary.add("ゆーざ", "test user-logaling test text", "") File.stub!(:mtime).and_return(Time.now - 1) repository.index - @terms = repository.lookup("user-logaling", glossary, true) + options = {"dictionary"=>true} + @terms = repository.lookup("user-logaling", glossary, options) @result = [{ :glossary_name=>"spec", :source_language=>"en", @@ -96,7 +97,8 @@ module Logaling glossary.add("user-logaling", "ユーザ", "ユーザーと迷い中 #{annotation_word}") File.stub!(:mtime).and_return(Time.now - 1) repository.index - @terms = repository.lookup("user", glossary, false, true) + options = {"no-annotation" => true} + @terms = repository.lookup("user", glossary, options) @result = [{ :glossary_name=>"spec", :source_language=>"en", -------------- next part -------------- An HTML attachment was scrubbed... Télécharger