null+****@clear*****
null+****@clear*****
Fri Feb 17 22:18:48 JST 2012
SHIMADA Koji 2012-02-17 22:18:48 +0900 (Fri, 17 Feb 2012) New Revision: cb6f91ba3464de5222be5354a6e6c8f965f96ba3 Log: Extract Config#keys method Modified files: lib/logaling/config.rb Modified: lib/logaling/config.rb (+8 -3) =================================================================== --- lib/logaling/config.rb 2012-02-17 16:52:08 +0900 (48572c5) +++ lib/logaling/config.rb 2012-02-17 22:18:48 +0900 (abd45d0) @@ -78,9 +78,9 @@ module Logaling def save(config_path) File.open(config_path, 'w') do |fp| - fp.puts "--glossary #{@config["glossary"]}" if @config["glossary"] - fp.puts "--source-language #{@config["source-language"]}" if @config["source-language"] - fp.puts "--target-language #{@config["target-language"]}" if @config["target-language"] + keys.each do |key| + fp.puts "--#{key} #{@config[key]}" if @config[key] + end end end @@ -95,5 +95,10 @@ module Logaling def target_language @config["target-language"] end + + private + def keys + %w(glossary source-language target-language) + end end end