種類
- インスタンスメソッド (172)
- 特異メソッド (30)
- ライブラリ (6)
ライブラリ
- pstore (22)
- shell (78)
-
shell
/ command-processor (36) -
shell
/ filter (66)
クラス
- PStore (22)
- Shell (78)
-
Shell
:: CommandProcessor (36) -
Shell
:: Filter (66)
キーワード
- < (6)
- > (6)
- >> (6)
-
alias
_ command (6) - cat (18)
- cd (6)
- chdir (6)
-
def
_ system _ command (6) - echo (18)
- glob (18)
-
in
_ transaction (11) -
install
_ system _ commands (6) - out (18)
- shell (6)
- tee (18)
-
to
_ s (6) - transaction (11)
-
unalias
_ command (6) -
undef
_ system _ command (6) - | (6)
検索結果
先頭5件
-
Shell
# transact { . . . } -> object (18213.0) -
ブロック中で shell を self として実行します。
...ブロック中で 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 と同じとなる。
}... -
Shell
:: CommandProcessor # transact { . . . } -> object (18213.0) -
ブロック中で shell を self として実行します。
...ブロック中で 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 と同じとなる。
}... -
Shell
:: Filter # transact { . . . } -> object (18213.0) -
ブロック中で shell を self として実行します。
...ブロック中で 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 と同じとなる。
}... -
PStore
# in _ transaction -> () (6200.0) -
トランザクションの中でなければ例外を発生させます。
トランザクションの中でなければ例外を発生させます。 -
PStore
# transaction(read _ only = false) {|pstore| . . . } -> object (6200.0) -
トランザクションに入ります。 このブロックの中でのみデータベースの読み書きができます。
...した場合に発生します。
例:
require 'pstore'
db = PStore.new("/tmp/foo")
db.transaction do
p db.roots # => []
ary = db["root"] = [1,2,3,4]
ary[0] = [1,1.5]
end
db.transaction(true) do |pstore|
pstore["root"] = 'aaa' # => ここで例外発生
end... -
Shell
# out(dev = STDOUT , &block) -> () (122.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) -> () (122.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) -> () (122.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
. alias _ command(alias , command , *opts) { . . . } -> self (118.0) -
コマンドの別名(エイリアス)を作成します。 コマンドが無い場合は、Shell.def_system_command などであらかじめ作成します.
...ンを指定します.
使用例: ls -la | sort -k 5 のような例。
require 'shell'
Shell.def_system_command("ls")
Shell.alias_command("lsla", "ls", "-a", "-l")
Shell.def_system_command("sort")
sh = Shell.new
sh.transact {
(lsla | sort("-k 5")).each {|l|
puts l
}
}... -
Shell
. install _ system _ commands(pre = "sys _ ") -> () (118.0) -
system_path上にある全ての実行可能ファイルをShellに定義する. メソッ ド名は元のファイル名の頭にpreをつけたものとなる.
...メソッド名の先頭に付加される文字列を指定します。
使用例: ls -l | head -n 5 のような例。
require 'shell'
Shell.install_system_commands
sh = Shell.new
sh.verbose = false
sh.transact {
(sys_ls("-l") | sys_head("-n 5")).each {|l|
puts l
}
}... -
Shell
. unalias _ command(alias) -> () (118.0) -
commandのaliasを削除します.
...合に発生します。
使用例: ls -la | sort -k 5 のような例。
require 'shell'
Shell.def_system_command("ls")
Shell.alias_command("lsla", "ls", "-a", "-l")
Shell.def_system_command("sort")
sh = Shell.new
sh.transact {
(lsla | sort("-k 5")).each {|l|
puts l
}
}... -
Shell
# cat(*files) -> Shell :: Filter (106.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...与えるファイル名を文字列で指定します。
動作例
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.tee"
}
}... -
Shell
# cd(path , &block) -> self (106.0) -
カレントディレクトリをpathにする. イテレータとして呼ばれたときには ブロック実行中のみカレントディレクトリを変更する.
...レクトリを文字列で指定します.
@param block path で指定したディレクトリで行う操作をブロックで指定します.
使用例
require 'shell'
sh = Shell.new
sh.transact {
cd("/tmp"){
p cwd #=> "/tmp"
}
p cwd #=> "/Users/kouya/rbmanual"
}... -
Shell
# chdir(path , &block) -> self (106.0) -
カレントディレクトリをpathにする. イテレータとして呼ばれたときには ブロック実行中のみカレントディレクトリを変更する.
...レクトリを文字列で指定します.
@param block path で指定したディレクトリで行う操作をブロックで指定します.
使用例
require 'shell'
sh = Shell.new
sh.transact {
cd("/tmp"){
p cwd #=> "/tmp"
}
p cwd #=> "/Users/kouya/rbmanual"
}... -
Shell
# echo(*strings) -> Shell :: Filter (106.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...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") >> "all.tee"
}
}...