別のキーワード
ライブラリ
- ビルトイン (456)
- logger (22)
-
net
/ telnet (2) - openssl (44)
- prettyprint (11)
- shell (6)
-
shell
/ command-processor (84) -
shell
/ process-controller (6) - tracer (22)
-
webrick
/ httpauth / basicauth (11) -
webrick
/ httpproxy (11) -
webrick
/ httpserver (11) -
webrick
/ httpservlet / prochandler (11)
クラス
- Enumerator (29)
-
Enumerator
:: Yielder (5) - Hash (88)
- LocalJumpError (22)
- Logger (22)
- Method (33)
- Module (22)
-
Net
:: Telnet (2) - Object (33)
-
OpenSSL
:: SSL :: SSLContext (44) - PrettyPrint (11)
- Proc (51)
- Shell (6)
-
Shell
:: CommandProcessor (84) -
Shell
:: ProcessController (6) - Thread (22)
- TracePoint (6)
- Tracer (22)
-
WEBrick
:: HTTPProxyServer (11) -
WEBrick
:: HTTPServer (11) -
WEBrick
:: HTTPServlet :: ProcHandler (11)
モジュール
- Kernel (68)
- Marshal (22)
- ObjectSpace (33)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - BasicAuth (11)
- Marshal フォーマット (11)
- Method (11)
-
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 1 . 0 (11) -
NEWS for Ruby 2
. 2 . 0 (10) -
NEWS for Ruby 2
. 3 . 0 (9) -
NEWS for Ruby 2
. 4 . 0 (8) -
NEWS for Ruby 2
. 5 . 0 (7) -
NEWS for Ruby 2
. 6 . 0 (6) -
NEWS for Ruby 2
. 7 . 0 (5) - Proc (11)
- Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (11)
- Ruby用語集 (11)
- [] (17)
-
add
_ trace _ func (11) - cat (6)
-
client
_ cert _ cb= (11) - default (22)
-
default
_ proc (11) -
define
_ finalizer (22) -
define
_ method (22) - drb (11)
- dump (22)
- echo (6)
-
exit
_ value (11) - foreach (6)
- format (11)
- formatter (11)
- formatter= (11)
- glob (6)
- inspect (11)
- irb (11)
- lambda (17)
- lambda? (11)
- link (6)
- logger (11)
- mkdir (6)
- new (103)
- out (6)
- parameters (17)
- preprocess (2)
- proc (18)
-
proc
_ new (11) -
proc
_ s _ new (11) -
rb
_ proc _ new (11) - reason (11)
-
renegotiation
_ cb= (11) -
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 2 feature (11) -
ruby 1
. 8 . 3 feature (11) - send (22)
-
session
_ new _ cb (11) -
session
_ new _ cb= (11) -
set
_ get _ line _ procs (22) -
set
_ trace _ func (11) - shift (11)
- size (11)
-
source
_ location (11) - symlink (6)
- system (6)
- tee (6)
- test (6)
-
to
_ proc (27) -
to
_ s (11) -
trace
_ var (33) - transact (6)
-
undef
_ system _ command (6) -
undefine
_ finalizer (11) -
values
_ at (11) - クラス/メソッドの定義 (11)
- セキュリティモデル (11)
- メソッド呼び出し(super・ブロック付き・yield) (11)
- 手続きオブジェクトの挙動の詳細 (11)
検索結果
先頭5件
-
手続きオブジェクトの挙動の詳細 (3316.0)
-
手続きオブジェクトの挙動の詳細 * def * should_use_next * block * lambda_proc * orphan
...e_next
* block
* lambda_proc
* orphan
===[a:def] 手続きオブジェクトとは
手続きオブジェクトとはブロックをコンテキスト(ローカル変数のスコープやスタックフレーム)と
ともにオブジェクトにしたものです。Proc クラスのインスタ......ローカル変数を参照できます。
Proc オブジェクトがローカル変数のスコープを保持していることは以下の例で変数 var を
参照できていることからわかります。
//emlist[例][ruby]{
var = 1
$foo = Proc.new { var }
var = 2
def foo
$foo.call
end......では Proc#call)
へジャンプし値を返すには next を使います。break や return ではありません。
//emlist[例][ruby]{
def foo
f = Proc.new{
next 1
2 # この行に到達することはない
}
end
p foo().call #=> 1
//}
===[a:block] Proc オ... -
ruby 1
. 6 feature (3300.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...00019>))
: 2002-09-11: Queue#((<Queue/pop>))
Queue#pop に競合状態の問題がありました ((<ruby-dev:17223>))
: 2002-09-11: SizedQueue.new
引数に 0 以下を受けつけるバグが修正されました。
: 2002-09-05: ((<リテラル/式展開>))
stable snapshot で、一......フォルト値 (((<Hash/default>))) も == で等しい
ときに等しいとみなされるようになりました。
p Hash.new("foo") == Hash.new("bar")
=> ruby 1.6.7 (2002-03-01) [i586-linux]
true
=> ruby 1.6.7 (2002-08-21) [i586-linux]
false......タンス変数が定義されていない場合例外 NameError を起こ
すようになりました。((<ruby-bugs-ja:PR#216>))
Object.new.instance_eval {
p remove_instance_variable :@foo
}
=> ruby 1.6.7 (2002-03-01) [i586-linux]
nil
=> -:2... -
Shell
:: CommandProcessor # link(old , new) -> 0 (3107.0) -
File クラスにある同名のクラスメソッドと同じです.
...File クラスにある同名のクラスメソッドと同じです.
@param old ファイル名を表す文字列を指定します。
@param new ファイル名を表す文字列を指定します。
@see File.link... -
Shell
:: CommandProcessor # symlink(old , new) -> 0 (3107.0) -
File クラスにある同名のクラスメソッドと同じです.
...File クラスにある同名のクラスメソッドと同じです.
@param old ファイル名を表す文字列を指定します。
@param new シンボリックリンクを表す文字列を指定します。
@see File.symlink... -
Shell
:: CommandProcessor # [](command , file1 , file2 = nil) -> bool | Time | Integer | nil (3006.0) -
Kernel.#test や FileTest のメソッドに処理を委譲します。
...指定します。
@param file2 文字列でファイルへのパスを指定します。
require 'shell'
Shell.verbose = false
sh = Shell.new
begin
sh.mkdir("foo")
rescue
end
p sh[?e, "foo"] # => true
p sh[:e, "foo"] # => true
p sh["e", "foo"] # => tru... -
Shell
:: CommandProcessor # cat(*files) -> Shell :: Filter (3006.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.tee"... -
Shell
:: CommandProcessor # echo(*strings) -> Shell :: Filter (3006.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"... -
Shell
:: CommandProcessor # foreach(path = nil , &block) -> () (3006.0) -
pathがファイルなら, File#foreach pathがディレクトリなら, Dir#foreach の動作をします。
...なら, File#foreach
pathがディレクトリなら, Dir#foreach
の動作をします。
@param path ファイルもしくはディレクトリのパスを文字列で指定します。
使用例
require 'shell'
Shell.verbose = false
sh = Shell.new
sh.foreach("/tmp"){|f|
puts f
}... -
Shell
:: CommandProcessor # glob(pattern) -> Shell :: Filter (3006.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
...ーンの書式については、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"... -
Shell
:: CommandProcessor # mkdir(*path) -> Array (3006.0) -
Dir.mkdirと同じです。 (複数可)
...ram path 作成するディレクトリ名を文字列で指定します。
@return 作成するディレクトリの一覧の配列を返します。
使用例
require 'shell'
Shell.verbose = false
sh = Shell.new
begin
p sh.mkdir("foo") #=> ["foo"]
rescue => err
puts err
end... -
Shell
:: CommandProcessor # out(dev = STDOUT , &block) -> () (3006.0) -
Shell#transact を呼び出しその結果を dev に出力します。
...ェクトなどで指定します。
@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 # system(command , *opts) -> Shell :: SystemCommand (3006.0) -
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 # tee(file) -> Shell :: Filter (3006.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.tee"... -
Shell
:: CommandProcessor # test(command , file1 , file2 = nil) -> bool | Time | Integer | nil (3006.0) -
Kernel.#test や FileTest のメソッドに処理を委譲します。
...指定します。
@param file2 文字列でファイルへのパスを指定します。
require 'shell'
Shell.verbose = false
sh = Shell.new
begin
sh.mkdir("foo")
rescue
end
p sh[?e, "foo"] # => true
p sh[:e, "foo"] # => true
p sh["e", "foo"] # => tru... -
Shell
:: CommandProcessor # transact { . . . } -> object (3006.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 と同じとなる。
}... -
Kernel
. # lambda -> Proc (484.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
...与えられたブロックから手続きオブジェクト (Proc のインスタンス)
を生成して返します。Proc.new に近い働きをします。
ブロックが指定されなければ、呼び出し元のメソッドで指定されたブロック
を手続きオブジェクトと......までは警告メッセージ
「warning: tried to create Proc object without a block」
が出力され、Ruby 2.7 では
ArgumentError (tried to create Proc object without a block)
が発生します。
ブロックを指定しない proc は、Ruby 2.7 では
$VERBOSE = true のときには警......告メッセージ
「warning: Capturing the given block using Proc.new is deprecated; use `&block` instead」
が出力され、Ruby 3.0 では
ArgumentError (tried to create Proc object without a block)
が発生します。
@raise ArgumentError スタック上にブロックがないのにブロ...