ライブラリ
- pstore (22)
- shell (24)
-
shell
/ command-processor (36) -
shell
/ filter (54)
クラス
- PStore (22)
- Shell (24)
-
Shell
:: CommandProcessor (36) -
Shell
:: Filter (54)
検索結果
先頭5件
-
Shell
# transact { . . . } -> object (24214.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 (24214.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 (24214.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 -> () (12201.0) -
トランザクションの中でなければ例外を発生させます。
トランザクションの中でなければ例外を発生させます。 -
PStore
# transaction(read _ only = false) {|pstore| . . . } -> object (12201.0) -
トランザクションに入ります。 このブロックの中でのみデータベースの読み書きができます。
...ザクションが使用可能です。
@param read_only 真を指定すると、読み込み専用のトランザクションになります。
@return ブロックで最後に評価した値を返します。
@raise PStore::Error read_only を真にしたときに、データベースを変更......した場合に発生します。
例:
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
:: CommandProcessor # echo(*strings) -> Shell :: Filter (3107.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!... -
Shell
:: CommandProcessor # glob(pattern) -> Shell :: Filter (3107.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...す.
@param pattern シェルコマンド glob に与えるパターンを指定します。
パターンの書式については、Dir.[] を参照してください。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").... -
Shell
:: CommandProcessor # out(dev = STDOUT , &block) -> () (3029.0) -
Shell#transact を呼び出しその結果を dev に出力します。
...ll#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 # cat(*files) -> Shell :: Filter (3007.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...マンド 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") >> "all.t... -
Shell
:: CommandProcessor # tee(file) -> Shell :: Filter (3007.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...コマンド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
# echo(*strings) -> Shell :: Filter (107.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!... -
Shell
# glob(pattern) -> Shell :: Filter (107.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...す.
@param pattern シェルコマンド glob に与えるパターンを指定します。
パターンの書式については、Dir.[] を参照してください。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").... -
Shell
:: Filter # echo(*strings) -> Shell :: Filter (107.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!... -
Shell
:: Filter # glob(pattern) -> Shell :: Filter (107.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...す.
@param pattern シェルコマンド glob に与えるパターンを指定します。
パターンの書式については、Dir.[] を参照してください。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").... -
Shell
:: Filter # to _ s -> String (107.0) -
実行結果を文字列で返します。
...実行結果を文字列で返します。
require 'shell'
Shell.def_system_command("wc")
sh = Shell.new
sh.transact {
puts (cat("/etc/passwd") | wc("-l")).to_s
}...