From: Tanaka Akira Date: 2009-11-30T18:26:18+09:00 Subject: [ruby-dev:39814] Re: RbConfig.rubybin In article <20091123.123808.1122146273169400964.kou@cozmixng.org>, Kouhei Sutou writes: > ただ、メソッド名はRbConfig.rubyの方がよい気がします。 ちょっとチャレンジな気がしますが、それもいいかも知れませんねぇ。 そうするとすると、こうでしょうか。 % svn diff --diff-cmd diff -x '-u -p' Index: lib/webrick/httpservlet/cgihandler.rb =================================================================== --- lib/webrick/httpservlet/cgihandler.rb (revision 25955) +++ lib/webrick/httpservlet/cgihandler.rb (working copy) @@ -17,9 +17,7 @@ module WEBrick module HTTPServlet class CGIHandler < AbstractServlet - Ruby = File::join(RbConfig::CONFIG['bindir'], - RbConfig::CONFIG['ruby_install_name']) - Ruby << RbConfig::CONFIG['EXEEXT'] + Ruby = RbConfig.ruby CGIRunner = "\"#{Ruby}\" \"#{WEBrick::Config::LIBDIR}/httpservlet/cgi_runner.rb\"" def initialize(server, name) Index: benchmark/report.rb =================================================================== --- benchmark/report.rb (revision 25955) +++ benchmark/report.rb (working copy) @@ -24,9 +24,7 @@ def exec_command type, file, w end def benchmark cmd - rubybin = ENV['RUBY'] || File.join( - RbConfig::CONFIG["bindir"], - RbConfig::CONFIG["ruby_install_name"] + RbConfig::CONFIG["EXEEXT"]) + rubybin = ENV['RUBY'] || RbConfig.ruby IO.popen(rubybin, 'r+'){|io| io.write cmd Index: benchmark/runc.rb =================================================================== --- benchmark/runc.rb (revision 25955) +++ benchmark/runc.rb (working copy) @@ -5,9 +5,7 @@ require 'benchmark' require 'rbconfig' -$rubybin = ENV['RUBY'] || File.join( - RbConfig::CONFIG["bindir"], - RbConfig::CONFIG["ruby_install_name"] + RbConfig::CONFIG["EXEEXT"]) +$rubybin = ENV['RUBY'] || RbConfig.ruby def runfile file puts file Index: tool/eval.rb =================================================================== --- tool/eval.rb (revision 25955) +++ tool/eval.rb (working copy) @@ -3,9 +3,7 @@ require 'rbconfig' require 'fileutils' require 'pp' -Ruby = ENV['RUBY'] || - File.join(RbConfig::CONFIG["bindir"], - RbConfig::CONFIG["ruby_install_name"] + RbConfig::CONFIG["EXEEXT"]) +Ruby = ENV['RUBY'] || RbConfig.ruby # OPTIONS = %w{ Index: tool/mkconfig.rb =================================================================== --- tool/mkconfig.rb (revision 25955) +++ tool/mkconfig.rb (working copy) @@ -201,6 +201,14 @@ print <