種類
- インスタンスメソッド (48)
- 特異メソッド (7)
ライブラリ
キーワード
- [] (1)
-
alias
_ command (2) - append (1)
- atime (1)
- basename (1)
- cat (1)
- chmod (1)
- chown (1)
- concat (1)
- ctime (1)
-
def
_ builtin _ commands (1) -
def
_ system _ command (1) - delete (1)
- directory? (1)
- dirname (1)
- echo (1)
- executable? (1)
-
executable
_ real? (1) - exist? (1)
- exists? (1)
- foreach (1)
- ftype (1)
- glob (1)
- initialize (1)
-
install
_ system _ commands (1) - join (1)
- lstat (1)
- mkdir (1)
- mtime (1)
- notify (1)
- open (1)
- out (1)
- readlink (1)
- rename (1)
- rm (1)
- rmdir (1)
- setgid? (1)
- setuid? (1)
- size (1)
- size? (1)
- socket? (1)
- split (1)
- stat (1)
- sticky? (1)
- system (1)
- tee (1)
- test (1)
- truncate (1)
-
undef
_ system _ command (1) - unlink (1)
- utime (1)
- writable? (1)
-
writable
_ real? (1)
検索結果
先頭5件
- Shell
:: CommandProcessor # utime(atime , mtime , *filename) -> Integer - Shell
:: CommandProcessor . def _ builtin _ commands(delegation _ class , commands _ specs) -> () - Shell
:: CommandProcessor # system(command , *opts) -> Shell :: SystemCommand - Shell
:: CommandProcessor # atime(filename) -> Time - Shell
:: CommandProcessor # ctime(filename) -> Time
-
Shell
:: CommandProcessor # utime(atime , mtime , *filename) -> Integer (19576.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param filename ファイル名を表す文字列を指定します。
@param atime 最終アクセス時刻を Time か、起算時からの経過秒数を数値で指定します。
@param utime 更新時刻を Time か、起算時からの経過秒数を数値で指定します。
@see File.utime -
Shell
:: CommandProcessor . def _ builtin _ commands(delegation _ class , commands _ specs) -> () (19288.0) -
@todo
@todo
@param delegation_class 処理を委譲したいクラスかモジュールを指定します。
@param commands_specs コマンドの仕様を文字列の配列で指定します。
[[コマンド名, [引数1, 引数2, ...]], ...] -
Shell
:: CommandProcessor # system(command , *opts) -> Shell :: SystemCommand (19258.0) -
command を実行する.
command を実行する.
@param command 実行するコマンドのパスを文字列で指定します。
@param opts command のオプションを文字列で指定します。複数可。
使用例:
require 'shell'
Shell.verbose = false
sh = Shell.new
print sh.system("ls", "-l")
Shell.def_system_command("head")
sh.system("ls", "-l") | sh.head("-n 3") > STDOUT -
Shell
:: CommandProcessor # atime(filename) -> Time (19240.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param filename ファイル名を表す文字列か IO オブジェクトを指定します。
@see File.atime -
Shell
:: CommandProcessor # ctime(filename) -> Time (19240.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param filename ファイル名を表す文字列か IO オブジェクトを指定します。
@see File.ctime -
Shell
:: CommandProcessor # delete(*filename) -> Integer (19240.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param filename ファイル名を表す文字列を指定します。
@see File.delete -
Shell
:: CommandProcessor # expand _ path(path) -> String (19240.0) -
Fileクラスにある同名のクラスメソッドと同じです.
Fileクラスにある同名のクラスメソッドと同じです.
@param path ファイル名を表す文字列を指定します。
@see File.expand_path -
Shell
:: CommandProcessor # lstat(filename) -> File :: Stat (19240.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param filename ファイル名を表す文字列を指定します。
@see File.lstat -
Shell
:: CommandProcessor # mtime(filename) -> Time (19240.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param filename ファイル名を表す文字列か IO オブジェクトを指定します。
@see File.mtime -
Shell
:: CommandProcessor # stat(filename) -> File :: Stat (19240.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param filename ファイル名を表す文字列を指定します。
@see File.stat -
Shell
:: CommandProcessor # tee(file) -> Shell :: Filter (19222.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
実行すると, それらを内容とする Filter オブジェクトを返します.
@param file シェルコマンドtee に与えるファイル名を文字列で指定します。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat(file).each { |l|
echo(l) | tee(file + ".tee") >> "all... -
Shell
:: CommandProcessor . def _ system _ command(command , path = command) -> () (18988.0) -
@todo
@todo
与えられたコマンドをメソッドとして定義します。
@param command 定義したいコマンドを指定します。
@param path command のパスを指定します。省略すると環境変数 PATH から command を探します。 -
Shell
:: CommandProcessor # truncate(path , length) -> 0 (18958.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param path パスを表す文字列を指定します。
@param length 変更したいサイズを整数で与えます。
@see File.truncate -
Shell
:: CommandProcessor # concat(*jobs) -> Shell :: Concat (18952.0) -
@todo
@todo -
Shell
:: CommandProcessor # notify(*opts) { . . . } -> () (18952.0) -
@todo
@todo -
Shell
:: CommandProcessor . initialize -> () (18952.0) -
@todo
@todo
このクラスを初期化します。 -
Shell
:: CommandProcessor # directory?(file) -> bool (18940.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列か IO オブジェクトを指定します。
@see FileTest.#directory? -
Shell
:: CommandProcessor # executable?(file) -> bool (18940.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列を指定します。
@see FileTest.#executable? -
Shell
:: CommandProcessor # executable _ real?(file) -> bool (18940.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列を指定します。
@see FileTest.#executable_real? -
Shell
:: CommandProcessor # exist?(file) -> bool (18940.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列か IO オブジェクトを指定します。
@see FileTest.#exist? FileTest.#exists? -
Shell
:: CommandProcessor # exists?(file) -> bool (18940.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列か IO オブジェクトを指定します。
@see FileTest.#exist? FileTest.#exists? -
Shell
:: CommandProcessor # ftype(filename) -> String (18940.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param filename ファイル名を表す文字列を指定します。
@see File.ftype -
Shell
:: CommandProcessor # out(dev = STDOUT , &block) -> () (18940.0) -
Shell#transact を呼び出しその結果を dev に出力します。
Shell#transact を呼び出しその結果を dev に出力します。
@param dev 出力先をIO オブジェクトなどで指定します。
@param block transact 内部で実行するシェルを指定します。
使用例:
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
File.open("out.txt", "w"){ |fp|
sh.out(fp) {
system("ls", "-l") | head("-n 3")
}
} -
Shell
:: CommandProcessor # setgid?(file) -> bool (18940.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列を指定します。
@see FileTest.#setgid? -
Shell
:: CommandProcessor # setuid?(file) -> bool (18940.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列を指定します。
@see FileTest.#setuid? -
Shell
:: CommandProcessor # socket?(file) -> bool (18940.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列を指定します。
@see FileTest.#socket? -
Shell
:: CommandProcessor # split(pathname) -> [String] (18940.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param pathname パス名を表す文字列を指定します。
@see File.split -
Shell
:: CommandProcessor # sticky?(file) -> bool (18940.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列を指定します。
@see FileTest.#sticky? -
Shell
:: CommandProcessor # writable?(file) -> bool (18940.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列を指定します。
@see FileTest.#writable? -
Shell
:: CommandProcessor # writable _ real?(file) -> bool (18940.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列を指定します。
@see FileTest.#writable_real? -
Shell
:: CommandProcessor # cat(*files) -> Shell :: Filter (18922.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
実行すると, それらを内容とする Filter オブジェクトを返します.
@param files シェルコマンド cat に与えるファイル名を文字列で指定します。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat(file).each { |l|
echo(l) | tee(file + ".tee") >> "al... -
Shell
:: CommandProcessor . install _ system _ commands(prefix = "sys _ ") -> () (18922.0) -
全てのシステムコマンドをメソッドとして定義します。
全てのシステムコマンドをメソッドとして定義します。
既に定義されているコマンドを再定義することはありません。
デフォルトでは全てのコマンドに "sys_" というプレフィクスが付きます。
また、メソッド名として使用できない文字は全て "_" に置換してメソッドを定義します。
このメソッドの実行中に発生した例外は単に無視されます。
@param prefix プレフィクスを指定します。 -
Shell
:: CommandProcessor . undef _ system _ command(command) -> self (18922.0) -
与えられたコマンドを削除します。
与えられたコマンドを削除します。
@param command 削除したいコマンド名を指定します。 -
Shell
:: CommandProcessor # test(command , file1 , file2 = nil) -> bool | Time | Integer | nil (10276.0) -
Kernel.#test や FileTest のメソッドに処理を委譲します。
Kernel.#test や FileTest のメソッドに処理を委譲します。
@param command 数値、またはサイズが 1 の文字列の場合は Kernel.#test に処理委譲します。
2 文字以上の文字列の場合は FileTest のメソッドとして実行します。
@param file1 文字列でファイルへのパスを指定します。
@param file2 文字列でファイルへのパスを指定します。
require 'shell'
Shell.verbose = false
sh = Shell.new
begin
sh.m... -
Shell
:: CommandProcessor # rm(*filename) -> Integer (9940.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param filename ファイル名を表す文字列を指定します。
@see File.delete -
Shell
:: CommandProcessor . alias _ command(alias , command , *opts) -> self (1024.0) -
@todo
@todo
@param alias エイリアスの名前を指定します。
@param command コマンド名を指定します。
@param opts コマンドに与えるオプションを指定します。
@raise SyntaxError コマンドのエイリアス作成に失敗した時に発生します。 -
Shell
:: CommandProcessor . alias _ command(alias , command , *opts) { . . . } -> self (1024.0) -
@todo
@todo
@param alias エイリアスの名前を指定します。
@param command コマンド名を指定します。
@param opts コマンドに与えるオプションを指定します。
@raise SyntaxError コマンドのエイリアス作成に失敗した時に発生します。 -
Shell
:: CommandProcessor # chown(owner , group , *filename) -> Integer (1012.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param owner chown(2) と同様に数値で指定します。nil または -1 を指定することで、オーナーを現在のままにすることができます。
@param group chown(2) と同様に数値で指定します。nil または -1 を指定することで、グループを現在のままにすることができます。
@param filename ファイル名を表す文字列を指定します。
@see File.chown -
Shell
:: CommandProcessor # append(to , filter) -> Shell :: AppendFile | Shell :: AppendIO (988.0) -
@todo
@todo
@param to 文字列か IO を指定します。
@param filter Shell::Filter のインスタンスを指定します。 -
Shell
:: CommandProcessor # [](command , file1 , file2 = nil) -> bool | Time | Integer | nil (976.0) -
Kernel.#test や FileTest のメソッドに処理を委譲します。
Kernel.#test や FileTest のメソッドに処理を委譲します。
@param command 数値、またはサイズが 1 の文字列の場合は Kernel.#test に処理委譲します。
2 文字以上の文字列の場合は FileTest のメソッドとして実行します。
@param file1 文字列でファイルへのパスを指定します。
@param file2 文字列でファイルへのパスを指定します。
require 'shell'
Shell.verbose = false
sh = Shell.new
begin
sh.m... -
Shell
:: CommandProcessor # basename(filename , suffix = "") -> String (958.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param filename ファイル名を表す文字列を指定します。
@param suffix サフィックスを文字列で与えます。'.*' という文字列を与えた場合、'*' はワイルドカードとして働き
'.' を含まない任意の文字列にマッチします。
@see File.basename -
Shell
:: CommandProcessor # chmod(mode , *filename) -> Integer (958.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param filename ファイル名を表す文字列を指定します。
@param mode chmod(2) と同様に整数で指定します。
@see File.chmod -
Shell
:: CommandProcessor # open(path , mode) -> File | Dir (958.0) -
path がファイルなら、 File.open path がディレクトリなら、 Dir.open の動作をします。
path がファイルなら、 File.open path がディレクトリなら、 Dir.open の動作をします。
@param path 開きたいパスを指定します。
@param mode アクセスモードを指定します。path がディレクトリの場合は無視されます。
@see File.open, Dir.open -
Shell
:: CommandProcessor # rename(from , to) -> 0 (958.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param from ファイルの名前を文字列で与えます。
@param to 新しいファイル名を文字列で与えます。
@see File.rename -
Shell
:: CommandProcessor # dirname(filename) -> String (940.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param filename ファイル名を表す文字列を指定します。
@see File.dirname -
Shell
:: CommandProcessor # glob(pattern) -> Shell :: Filter (940.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
実行すると, それらを内容とする Filter オブジェクトを返します.
@param pattern シェルコマンド glob に与えるパターンを指定します。
パターンの書式については、Dir.[] を参照してください。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat(file).each { |l|
... -
Shell
:: CommandProcessor # join(*item) -> String (940.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param item 連結したいディレクトリ名やファイル名を文字列で与えます。
@see File.join -
Shell
:: CommandProcessor # mkdir(*path) -> Array (940.0) -
Dir.mkdirと同じです。 (複数可)
Dir.mkdirと同じです。 (複数可)
@param path 作成するディレクトリ名を文字列で指定します。
@return 作成するディレクトリの一覧の配列を返します。
使用例
require 'shell'
Shell.verbose = false
sh = Shell.new
begin
p sh.mkdir("foo") #=> ["foo"]
rescue => err
puts err
end -
Shell
:: CommandProcessor # readlink(path) -> String (940.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param path シンボリックリンクを表す文字列を指定します。
@see File.readlink -
Shell
:: CommandProcessor # size(file) -> Integer (940.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列を指定します。
@see FileTest.#size FileTest.#size? -
Shell
:: CommandProcessor # size?(file) -> Integer | nil (940.0) -
FileTest モジュールにある同名のクラスメソッドと同じです.
FileTest モジュールにある同名のクラスメソッドと同じです.
@param file ファイル名を表す文字列を指定します。
@see FileTest.#size FileTest.#size? -
Shell
:: CommandProcessor # unlink(path) -> self (940.0) -
path がファイルなら File.unlink、path がディレクトリなら Dir.unlink の動作をします。
path がファイルなら File.unlink、path がディレクトリなら Dir.unlink の動作をします。
@param path 削除したいパスを指定します。
@see File.unlink, Dir.unlink -
Shell
:: CommandProcessor # echo(*strings) -> Shell :: Filter (922.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
実行すると, それらを内容とする Filter オブジェクトを返します.
@param strings シェルコマンド echo に与える引数を文字列で指定します。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat(file).each { |l|
echo(l) | tee(file + ".tee") >> "al... -
Shell
:: CommandProcessor # foreach(path = nil , &block) -> () (922.0) -
pathがファイルなら, File#foreach pathがディレクトリなら, Dir#foreach の動作をします。
pathがファイルなら, File#foreach
pathがディレクトリなら, Dir#foreach
の動作をします。
@param path ファイルもしくはディレクトリのパスを文字列で指定します。
使用例
require 'shell'
Shell.verbose = false
sh = Shell.new
sh.foreach("/tmp"){|f|
puts f
} -
Shell
:: CommandProcessor # rmdir(*path) -> () (922.0) -
Dir.rmdirと同じです。 (複数可)
Dir.rmdirと同じです。 (複数可)
@param path 削除するディレクトリ名を文字列で指定します。