Ruby 1.9.2 リファレンスマニュアル > ライブラリ一覧 > shell/command-processorライブラリ > Shell::CommandProcessorクラス > transact
transact { ... } -> object[permalink][rdoc]ブロック中で shell を self として実行します。
例:
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact{
system("ls", "-l") | head > STDOUT
# transact の中では、
# sh.system("ls", "-l") | sh.head > STDOUT と同じとなる。
}