前田です。 In message "[ruby-list:6417] rgrep (Re: call for scripts)" Shugo Maeda <shugo / po.aianet.ne.jp> wrote: |すみません、終了ステータスのことを忘れていたので、 |手直ししました。 再びすみません(^^; foreach_filesという名前がどうも変な気がするのでscan_files に変更しました。 # プログラミング時間のかなりの部分を名前選びに使っている # ような気がします...。 # 名前を選んでくれるRubyスクリプトとかないかなあ。 -- 前田 修吾
--- rgrep~ Sun Feb 15 12:05:15 1998 +++ rgrep Sun Feb 15 12:31:43 1998 @@ -3,14 +3,14 @@ GREP_CMD = 'grep' GREP_ARGS = [] -def foreach_files(path) +def scan_files(path) if FileTest.directory?(path) if path[-1] != ?/ path = path + '/' end Dir.foreach(path) do |file| if file != '.' and file != '..' - foreach_files(path + file) do |file| + scan_files(path + file) do |file| yield(file) end end @@ -34,7 +34,7 @@ GREP_ARGS.push(arg) if arg # expr for path in ARGV - foreach_files(path) do |file| + scan_files(path) do |file| GREP_ARGS.push(file) end end