ライブラリ
- ビルトイン (2)
- benchmark (1)
- matrix (1)
- mkmf (1)
-
net
/ ftp (1) - rake (1)
-
rexml
/ document (1) -
rexml
/ sax2listener (2) -
rexml
/ streamlistener (3) - shell (9)
-
shell
/ command-processor (7) -
shell
/ filter (11) -
shell
/ system-command (15)
クラス
-
Benchmark
:: Tms (1) - IO (1)
- Matrix (1)
-
Net
:: FTP (1) -
RDoc
:: Options (1) -
REXML
:: NotationDecl (1) - Shell (9)
-
Shell
:: CommandProcessor (7) -
Shell
:: Filter (11) -
Shell
:: SystemCommand (15) - String (1)
モジュール
- FileUtils (1)
- Kernel (1)
-
REXML
:: SAX2Listener (2) -
REXML
:: StreamListener (3)
キーワード
- < (1)
- > (1)
- >> (1)
- active? (1)
- cat (3)
-
close
_ on _ exec= (1) - command (1)
- doctype (2)
- each (1)
- echo (3)
- eigensystem (1)
- entitydecl (1)
-
find
_ system _ command (3) - flush (1)
- format (1)
- glob (3)
- input= (1)
- kill (1)
- name (1)
- notationdecl (2)
- notify (2)
-
op
_ dir (1) - out (3)
- sh (1)
- start (1)
-
start
_ export (1) -
start
_ import (1) - sum (1)
-
super
_ each (1) - system= (1)
-
system
_ path (1) -
system
_ path= (1) - tee (3)
- terminate (1)
- wait? (1)
- xsystem (1)
- | (1)
検索結果
先頭5件
-
Shell
# system(command , *opts) -> Shell :: SystemCommand (54697.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 # system(command , *opts) -> Shell :: SystemCommand (54697.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
:: Filter # system(command , *opts) -> Shell :: SystemCommand (54697.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 -
Net
:: FTP # system -> String (54379.0) -
サーバーの OS のタイプを返します。
サーバーの OS のタイプを返します。
@raise Net::FTPTempError 応答コードが 4yz のときに発生します。
@raise Net::FTPPermError 応答コードが 5yz のときに発生します。
@raise Net::FTPProtoError 応答コードが RFC 的に正しくない場合に発生します。
@raise Net::FTPReplyError 応答コードが上の場合以外でエラーである場合に発生します。 -
Kernel
# xsystem(command , opts = nil) -> () (18424.0) -
Kernel.#system と同じですが、コマンドの出力は(標準出力、標準エラー 出力ともに)ログファイルに出力します。ログファイル名は mkmf.log です。
Kernel.#system と同じですが、コマンドの出力は(標準出力、標準エラー
出力ともに)ログファイルに出力します。ログファイル名は mkmf.log です。
@param command コマンドを指定します。
@param opts オプションを Hash で指定します。
:werror というキーに真を指定すると
@see Kernel.#system -
Shell
# system _ path -> Array (18364.0) -
コマンドサーチパスの配列を返す。
コマンドサーチパスの配列を返す。
@param path コマンドサーチパスの配列を指定します。
使用例
require 'shell'
sh = Shell.new
sh.system_path = [ "./" ]
p sh.system_path #=> ["./"] -
Shell
# system _ path=(path) (18364.0) -
コマンドサーチパスの配列を返す。
コマンドサーチパスの配列を返す。
@param path コマンドサーチパスの配列を指定します。
使用例
require 'shell'
sh = Shell.new
sh.system_path = [ "./" ]
p sh.system_path #=> ["./"] -
Shell
# find _ system _ command(command) (18355.0) -
@todo
@todo -
Shell
:: CommandProcessor # find _ system _ command(command) (18355.0) -
@todo
@todo -
Shell
:: Filter # find _ system _ command(command) (18355.0) -
@todo
@todo -
REXML
:: NotationDecl # system=(value) (18325.0) -
システム識別子を変更します。
システム識別子を変更します。
@param value 設定するシステム識別子 -
Matrix
# eigensystem -> Matrix :: EigenvalueDecomposition (9340.0) -
行列の固有値と左右の固有ベクトルを保持したオブジェクトを返します。
行列の固有値と左右の固有ベクトルを保持したオブジェクトを返します。
Matrix::EigenvalueDecomposition は to_ary を定義しているため、
多重代入によって3つの行列(右固有ベクトル、固有値行列、左固有ベクトル)
を得ることができます。
これを [V, D, W] と書くと、
(元の行列が対角化可能ならば)、
D は対角行列で、 self == V*D*W, V = W.inverse を満たします。
D のそれぞれの対角成分が行列の固有値です。
//emlist[例][ruby]{
require 'matrix'
m = Matrix[[1, 2], [... -
Shell
:: SystemCommand # notify(*opts) -> String (9088.0) -
@todo
@todo
@param opts
@see Shell#notify -
Shell
:: SystemCommand # notify(*opts) {|message| . . . } -> String (9088.0) -
@todo
@todo
@param opts
@see Shell#notify -
Shell
:: SystemCommand # each(rs = nil) {|line| . . . } (9070.0) -
@todo
@todo
@param rs -
Shell
:: SystemCommand # active? -> bool (9052.0) -
@todo
@todo -
Shell
:: SystemCommand # command -> String (9052.0) -
@todo
@todo
コマンド名を返します。 -
Shell
:: SystemCommand # flush -> () (9052.0) -
@todo
@todo -
Shell
:: SystemCommand # input=(inp) (9052.0) -
@todo
@todo -
Shell
:: SystemCommand # name -> String (9052.0) -
@todo
@todo
コマンド名を返します。 -
Shell
:: SystemCommand # start -> () (9052.0) -
@todo
@todo -
Shell
:: SystemCommand # start _ export (9052.0) -
@todo
@todo -
Shell
:: SystemCommand # start _ import -> () (9052.0) -
@todo
@todo -
Shell
:: SystemCommand # super _ each -> () (9052.0) -
@todo
@todo
Shell::Filter#each です。 -
Shell
:: SystemCommand # terminate -> () (9052.0) -
@todo
@todo -
Shell
:: SystemCommand # wait? -> bool (9052.0) -
@todo
@todo -
Shell
:: SystemCommand # kill(signal) -> Integer (9040.0) -
自身のプロセスにシグナルを送ります。
自身のプロセスにシグナルを送ります。
@param signal シグナルを整数かその名前の文字列で指定します。
負の値を持つシグナル(あるいはシグナル名の前に-)を指定すると、
プロセスではなくプロセスグループにシグナルを送ります。
@see Process.#kill -
REXML
:: SAX2Listener # notationdecl(name , public _ or _ system , public _ id , system _ id) -> () (736.0) -
DTDの記法宣言に出会ったときに呼び出されるコールバックメソッドです。
DTDの記法宣言に出会ったときに呼び出されるコールバックメソッドです。
@param name 記法名が文字列で渡されます
@param public_or_system "PUBLIC" もしくは "SYSTEM" が渡されます
@param public_id 公開識別子が文字列で渡されます。指定されていない場合はnilが渡されます
@param system_id システム識別子が文字列で渡されます。指定されていない場合はnilが渡されます -
REXML
:: SAX2Listener # doctype(name , pub _ sys , long _ name , uri) -> () (130.0) -
文書型宣言(DTD)に出会った時に呼び出されるコールバックメソッドです。
文書型宣言(DTD)に出会った時に呼び出されるコールバックメソッドです。
@param name 宣言されているルート要素名が文字列で渡されます。
@param pub_sys "PUBLIC" もしくは "SYSTEM" が渡されます。nilが渡される場合もあります。
@param long_name "SYSTEM" の場合はシステム識別子が、"PUBLIC"の場合は公開識別子が
文字列で渡されます
@param uri "SYSTEM" の場合は nil が、"PUBLIC" の場合はシステム識別子が渡されます -
REXML
:: StreamListener # doctype(name , pub _ sys , long _ name , uri) -> () (130.0) -
文書型宣言(DTD)をパースしたときに呼び出されるコールバックメソッドです。
文書型宣言(DTD)をパースしたときに呼び出されるコールバックメソッドです。
pub_sys, long_name, uri はDTDが内部サブセットのみを
利用している場合には nil が渡されます。
@param name 宣言されているルート要素名が文字列で渡されます。
@param pub_sys "PUBLIC" もしくは "SYSTEM" が渡されます。nilが渡される場合もあります。
@param long_name "SYSTEM" の場合はシステム識別子が、"PUBLIC"の場合は公開識別子が
文字列で渡されます
@param uri "SYSTEM" の場... -
REXML
:: StreamListener # entitydecl(content) -> () (94.0) -
DTDの実体宣言をパースしたときに呼び出されるコールバックメソッドです。
DTDの実体宣言をパースしたときに呼び出されるコールバックメソッドです。
@param content 実体宣言が配列で渡されます
実体宣言の書き方によって content に渡されるデータの形式が異なります。
//emlist[][ruby]{
require 'rexml/parsers/baseparser'
require 'rexml/parsers/streamparser'
require 'rexml/streamlistener'
xml = <<EOS
<!DOCTYPE root [
<!ENTITY % YN '"Yes"'>
<!ENTITY % YN 'Yes... -
Shell
:: Filter # |(filter) -> object (94.0) -
パイプ結合を filter に対して行います。
パイプ結合を filter に対して行います。
@param filter Shell::Filter オブジェクトを指定します。
@return filter を返します。
使用例
require 'shell'
Shell.def_system_command("tail")
Shell.def_system_command("head")
Shell.def_system_command("wc")
sh = Shell.new
sh.transact {
i = 1
while i <= (cat("/etc/passwd") | wc(... -
Benchmark
:: Tms # format(fmtstr = nil , *args) -> String (76.0) -
self を指定されたフォーマットで整形して返します。
self を指定されたフォーマットで整形して返します。
このメソッドは Kernel.#format のようにオブジェクトを整形しますが、
以下の拡張を使用することができます。
: %u
user CPU time で置き換えられます。Benchmark::Tms#utime
: %y
system CPU time で置き換えられます(Mnemonic: y of "s*y*stem")。Benchmark::Tms#stime
: %U
子プロセスの user CPU time で置き換えられます。Benchmark::Tms#cutime
: %Y
子プロセスの s... -
IO
# close _ on _ exec=(bool) (76.0) -
自身に close-on-exec フラグを設定します。
自身に close-on-exec フラグを設定します。
このフラグをセットすると exec(2) 時にそのファイルデスクリプタを
close します。
@see fcntl(2)
@param bool 自身の close-on-exec フラグを true か false で指定します。
f = open("/dev/null")
f.close_on_exec = true
system("cat", "/proc/self/fd/#{f.fileno}") # cat: /proc/self/fd/3: No such file or directory
... -
Shell
# out(dev = STDOUT , &block) -> () (76.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 # out(dev = STDOUT , &block) -> () (76.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
:: Filter # out(dev = STDOUT , &block) -> () (76.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")
}
} -
FileUtils
# sh(*cmd) {|result , status| . . . } (58.0) -
与えられたコマンドを実行します。
与えられたコマンドを実行します。
与えられた引数が複数の場合、シェルを経由しないでコマンドを実行します。
@param cmd 引数の解釈に関しては Kernel.#exec を参照してください。
例:
sh %{ls -ltr}
sh 'ls', 'file with spaces'
# check exit status after command runs
sh %{grep pattern file} do |ok, res|
if ! ok
puts "pattern not found (status = #... -
Shell
# glob(pattern) -> Shell :: Filter (58.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 # glob(pattern) -> Shell :: Filter (58.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
:: Filter # glob(pattern) -> Shell :: Filter (58.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|
... -
RDoc
:: Options # op _ dir -> String (40.0) -
コマンドライン引数の --op オプションで指定したディレクトリを返します。
コマンドライン引数の --op オプションで指定したディレクトリを返します。
--ri、--ri-site、--ri-system オプションにも影響される事に注意してください。
@return 設定されたディレクトリを文字列で返します。 -
REXML
:: StreamListener # notationdecl(content) -> () (40.0) -
DTDの記法宣言をパースしたときに呼び出されるコールバックメソッドです。
DTDの記法宣言をパースしたときに呼び出されるコールバックメソッドです。
@param content 記法宣言が
[記法名文字列, 種別("PUBLIC" もしくは "SYSTEM"), 公開識別子文字列,
URI文字列] という配列で渡されます。 -
Shell
# cat(*files) -> Shell :: Filter (40.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
# echo(*strings) -> Shell :: Filter (40.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
# tee(file) -> Shell :: Filter (40.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 # cat(*files) -> Shell :: Filter (40.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 # echo(*strings) -> Shell :: Filter (40.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 # tee(file) -> Shell :: Filter (40.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
:: Filter # <(src) -> self (40.0) -
srcをフィルタの入力とする。 srcが, 文字列ならばファイルを, IOオブジェクトであれ ばそれをそのまま入力とする。
srcをフィルタの入力とする。 srcが, 文字列ならばファイルを, IOオブジェクトであれ
ばそれをそのまま入力とする。
@param src フィルタの入力を, 文字列もしくは,IO オブジェクトで指定します。
使用例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
(sh.head("-n 30") < "/etc/passwd") > "ugo.txt"
} -
Shell
:: Filter # >(to) -> self (40.0) -
toをフィルタの出力とする。 toが, 文字列ならばファイルに, IOオブジェクトであれ ばそれをそのまま出力とする。
toをフィルタの出力とする。 toが, 文字列ならばファイルに, IOオブジェクトであれ
ばそれをそのまま出力とする。
@param to 出力先を指定します。文字列ならばファイルに,IOオブジェクトならばそれに出力します。
使用例
require 'shell'
Shell.def_system_command("tail")
sh = Shell.new
sh.transact {
(sh.tail("-n 3") < "/etc/passwd") > File.open("tail.out", "w")
#(sh.tail("-n 3") < "/e... -
Shell
:: Filter # >>(to) -> self (40.0) -
toをフィルタに追加する。 toが, 文字列ならばファイルに, IOオブジェクトであれば それをそのまま出力とする。
toをフィルタに追加する。 toが, 文字列ならばファイルに, IOオブジェクトであれば
それをそのまま出力とする。
@param to 出力先を指定します。文字列ならばファイルに、IOオブジェクトならばそれに出力します。
使用例
require 'shell'
Shell.def_system_command("tail")
sh = Shell.new
sh.transact {
(sh.tail("-n 3") < "/etc/passwd") >> "tail.out"
#(sh.tail("-n 3") < "/etc/passwd") >> ... -
Shell
:: Filter # cat(*files) -> Shell :: Filter (40.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
:: Filter # echo(*strings) -> Shell :: Filter (40.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
:: Filter # tee(file) -> Shell :: Filter (40.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... -
String
# sum(bits = 16) -> Integer (40.0) -
文字列の bits ビットのチェックサムを計算します。
文字列の bits ビットのチェックサムを計算します。
以下と同じです。
//emlist[][ruby]{
def sum(bits)
sum = 0
each_byte {|c| sum += c }
return 0 if sum == 0
sum & ((1 << bits) - 1)
end
//}
例えば以下のコードで UNIX System V の
sum(1) コマンドと同じ値が得られます。
//emlist[例][ruby]{
sum = 0
ARGF.each_line do |line|
sum += line.sum
end
sum %= ...