[ruby-dev:31770] Re: shellescape

From: "Akinori MUSHA" <knu@...>
Date: 2007-09-10 07:12:58 UTC
List: ruby-dev #31770
At Mon, 10 Sep 2007 16:01:47 +0900,
Nobuyoshi Nakada wrote:
> At Mon, 10 Sep 2007 15:10:13 +0900,
> Akinori MUSHA wrote in [ruby-dev:31768]:
> > - Shellwords.shellescape を追加:
> >     Bourneシェルに解釈される可能性のある文字をエスケープして返す
> >     (仕様は実装およびコメントを参照のこと)
> >
> > - Shellwords.shelljoin を追加:
> >     与えられた引数列から、Bourneシェルコマンドライン文字列を生成
> >     して返す (shellescape を利用)
> >
> > - Shellwords.shellwords の別名 shellsplit を定義
>
> モジュール関数に関する限り、shellというprefixはなくてもいいんじゃ
> ないかと思うのですが、Shellwords.escapeやShellwords.join,
> Shellwords.splitなどではまずいでしょうか。

 私もそう思いました。しかし、現行のサンプルで include Shellwords
する用例が載っているため、それを踏襲したコードが名前空間の汚染で
動かなくなる可能性があります。(特に split)

 included() を定義して長い名前の方だけ落とすという手段はあるかも
しれませんが…。

--
                     /
                    /__  __            Akinori.org / MUSHA.org
                   / )  )  ) )  /     FreeBSD.org / Ruby-lang.org
Akinori MUSHA aka / (_ /  ( (__(  @ iDaemons.org / and.or.jp

"Different eyes see different things,
    Different hearts beat on different strings --
       But there are times for you and me when all such things agree"

In This Thread