るりまサーチ

最速Rubyリファレンスマニュアル検索!
108件ヒット [1-100件を表示] (0.087秒)
トップページ > クエリ:p[x] > クエリ:transact[x]

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. kernel p
  5. rsa p

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

Shell::CommandProcessor#transact { ... } -> object (21113.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#transaction(read_only = false) {|pstore| ... } -> object (9206.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|
p
store["root"] = 'aaa' # => ここで例外発生
end...

PStore#in_transaction -> () (9100.0)

トランザクションの中でなければ例外を発生させます。

トランザクションの中でなければ例外を発生させます。

Shell::CommandProcessor#glob(pattern) -> Shell::Filter (3106.0)

実行すると, それらを内容とする 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|
echo(l) | tee(file + ".tee") >> "all.tee"
}
}
}

@see Dir.[]...

Shell::CommandProcessor#out(dev = STDOUT, &block) -> () (3022.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#cat(*files) -> Shell::Filter (3006.0)

実行すると, それらを内容とする 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 { |...

Shell::CommandProcessor#echo(*strings) -> Shell::Filter (3006.0)

実行すると, それらを内容とする 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|...

Shell::CommandProcessor#tee(file) -> Shell::Filter (3006.0)

実行すると, それらを内容とする 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|...

Shell#cd(path, &block) -> self (118.0)

カレントディレクトリをpathにする. イテレータとして呼ばれたときには ブロック実行中のみカレントディレクトリを変更する.

...カレントディレクトリをpathにする. イテレータとして呼ばれたときには
ブロック実行中のみカレントディレクトリを変更する.

@param 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 (118.0)

カレントディレクトリをpathにする. イテレータとして呼ばれたときには ブロック実行中のみカレントディレクトリを変更する.

...カレントディレクトリをpathにする. イテレータとして呼ばれたときには
ブロック実行中のみカレントディレクトリを変更する.

@param path カレントディレクトリを文字列で指定します.

@param block path で指定したディレクト...
...リで行う操作をブロックで指定します.

使用例
require 'shell'
sh = Shell.new
sh.transact {
cd("/tmp"){
p
cwd #=> "/tmp"
}
p
cwd #=> "/Users/kouya/rbmanual"
}...

絞り込み条件を変える

Shell#glob(pattern) -> Shell::Filter (106.0)

実行すると, それらを内容とする 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|
echo(l) | tee(file + ".tee") >> "all.tee"
}
}
}

@see Dir.[]...

Shell.alias_command(alias, command, *opts) {...} -> self (106.0)

コマンドの別名(エイリアス)を作成します。 コマンドが無い場合は、Shell.def_system_command などであらかじめ作成します.

...場合は、Shell.def_system_command などであらかじめ作成します.

@param alias エイリアスの名前を文字列で指定します.

@param command コマンド名を文字列で指定します.

@param opts 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|
p
uts l
}
}...

Shell.def_system_command(command, path = command) -> nil (106.0)

Shell のメソッドとして command を登録します.

...ドを定義しなくとも直接実行できる Shell#system コマンドもあります.

@param command Shell のメソッドとして定義するコマンドを文字列で指定します。

@param path command のパスを指定します。
指定しない場合はcommand と同じ...
...require 'shell'
Shell.def_system_command "ls"
# ls を定義

Shell.def_system_command "sys_sort", "sort"
# sortコマンドをsys_sortとして定義

sh = Shell.new
sh.transact {
ls.each { |l|
p
uts l
}
(ls("-l") | sys_sort("-k 5")).each {|l|
p
uts l
}
}...

Shell.install_system_commands(pre = "sys_") -> () (106.0)

system_path上にある全ての実行可能ファイルをShellに定義する. メソッ ド名は元のファイル名の頭にpreをつけたものとなる.

...system_path上にある全ての実行可能ファイルをShellに定義する. メソッ
ド名は元のファイル名の頭にpreをつけたものとなる.

@param pre Shellに定義するメソッド名の先頭に付加される文字列を指定します。

使用例: 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|
p
uts l
}
}...

Shell.undef_system_command(command) -> Shell::CommandProcessor (106.0)

commandを削除します.

...す.

@param command 削除するコマンドの文字列を指定します。

動作例:
require 'shell'
Shell.def_system_command("ls")
# ls を定義
Shell.undef_system_command("ls")
# ls を 削除

sh = Shell.new
begin
sh.transact {
ls("-l").each {|l|
p
uts l...
...}
}
rescue NameError => err
p
uts err
end...

絞り込み条件を変える

<< 1 2 > >>