るりまサーチ

最速Rubyリファレンスマニュアル検索!
133件ヒット [1-100件を表示] (0.025秒)

別のキーワード

  1. kernel system
  2. kernel exec
  3. kernel spawn
  4. kernel open
  5. kernel gsub

検索結果

<< 1 2 > >>

Proc (38258.0)

ブロックをコンテキスト(ローカル変数のスコープやスタックフ レーム)とともにオブジェクト化した手続きオブジェクトです。

...手続きオブジェクトです。

Proc
は ローカル変数のスコープを導入しないことを除いて
名前のない関数のように使えます。ダイナミックローカル変数は
Proc
ローカルの変数として使えます。

Proc
がローカル変数のスコープ...
...k }
//}

//emlist[LocalJumpError が発生します。][ruby]{
pr = Proc.new { break }
(1..5).each(&pr)
//}

===[a:lambda_proc] lambda と proc Proc.new とイテレータの違い

Kernel
.#lambda と Proc.new はどちらも Proc クラスのインスタンス(手続きオブジェクト)を生...
...lambda と Proc.new では挙動が異なります。
例えば return を行った場合、lambda では手続きオブジェクト自身を抜けますが、
Proc
.new では手続きオブジェクトを囲むメソッドを抜けます。

//emlist[例][ruby]{
def test_proc
f = Proc.new { retur...

Kernel.#proc -> Proc (24514.0)

与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。

...与えられたブロックから手続きオブジェクト (Proc のインスタンス)
を生成して返します。Proc.new に近い働きをします。

ブロックが指定されなければ、呼び出し元のメソッドで指定されたブロック
を手続きオブジェクトと...
...k }
//}

//emlist[LocalJumpError が発生します。][ruby]{
pr = Proc.new { break }
(1..5).each(&pr)
//}

===[a:lambda_proc] lambda と proc Proc.new とイテレータの違い

Kernel
.#lambda と Proc.new はどちらも Proc クラスのインスタンス(手続きオブジェクト)を生...
...lambda と Proc.new では挙動が異なります。
例えば return を行った場合、lambda では手続きオブジェクト自身を抜けますが、
Proc
.new では手続きオブジェクトを囲むメソッドを抜けます。

//emlist[例][ruby]{
def test_proc
f = Proc.new { retur...

Kernel.#proc { ... } -> Proc (24514.0)

与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。

...与えられたブロックから手続きオブジェクト (Proc のインスタンス)
を生成して返します。Proc.new に近い働きをします。

ブロックが指定されなければ、呼び出し元のメソッドで指定されたブロック
を手続きオブジェクトと...
...k }
//}

//emlist[LocalJumpError が発生します。][ruby]{
pr = Proc.new { break }
(1..5).each(&pr)
//}

===[a:lambda_proc] lambda と proc Proc.new とイテレータの違い

Kernel
.#lambda と Proc.new はどちらも Proc クラスのインスタンス(手続きオブジェクト)を生...
...lambda と Proc.new では挙動が異なります。
例えば return を行った場合、lambda では手続きオブジェクト自身を抜けますが、
Proc
.new では手続きオブジェクトを囲むメソッドを抜けます。

//emlist[例][ruby]{
def test_proc
f = Proc.new { retur...

Kernel.#proc -> Proc (24513.0)

与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。

...与えられたブロックから手続きオブジェクト (Proc のインスタンス)
を生成して返します。Proc.new に近い働きをします。

ブロックが指定されなければ、呼び出し元のメソッドで指定されたブロック
を手続きオブジェクトと...
...k }
//}

//emlist[LocalJumpError が発生します。][ruby]{
pr = Proc.new { break }
(1..5).each(&pr)
//}

===[a:lambda_proc] lambda と proc Proc.new とイテレータの違い

Kernel
.#lambda と Proc.new はどちらも Proc クラスのインスタンス(手続きオブジェクト)を生...
...lambda と Proc.new では挙動が異なります。
例えば return を行った場合、lambda では手続きオブジェクト自身を抜けますが、
Proc
.new では手続きオブジェクトを囲むメソッドを抜けます。

//emlist[例][ruby]{
def test_proc
f = Proc.new { retur...

Kernel.#proc { ... } -> Proc (24513.0)

与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。

...与えられたブロックから手続きオブジェクト (Proc のインスタンス)
を生成して返します。Proc.new に近い働きをします。

ブロックが指定されなければ、呼び出し元のメソッドで指定されたブロック
を手続きオブジェクトと...
...k }
//}

//emlist[LocalJumpError が発生します。][ruby]{
pr = Proc.new { break }
(1..5).each(&pr)
//}

===[a:lambda_proc] lambda と proc Proc.new とイテレータの違い

Kernel
.#lambda と Proc.new はどちらも Proc クラスのインスタンス(手続きオブジェクト)を生...
...lambda と Proc.new では挙動が異なります。
例えば return を行った場合、lambda では手続きオブジェクト自身を抜けますが、
Proc
.new では手続きオブジェクトを囲むメソッドを抜けます。

//emlist[例][ruby]{
def test_proc
f = Proc.new { retur...
...与えられたブロックから手続きオブジェクト (Proc のインスタンス)
を生成して返します。Proc.new に近い働きをします。


また、lambda に & 引数を渡すのは推奨されません。& 引数ではなくてブロック記法で記述する必要があ...

絞り込み条件を変える

Kernel.#lambda -> Proc (21414.0)

与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。

...与えられたブロックから手続きオブジェクト (Proc のインスタンス)
を生成して返します。Proc.new に近い働きをします。

ブロックが指定されなければ、呼び出し元のメソッドで指定されたブロック
を手続きオブジェクトと...
...k }
//}

//emlist[LocalJumpError が発生します。][ruby]{
pr = Proc.new { break }
(1..5).each(&pr)
//}

===[a:lambda_proc] lambda と proc Proc.new とイテレータの違い

Kernel
.#lambda と Proc.new はどちらも Proc クラスのインスタンス(手続きオブジェクト)を生...
...lambda と Proc.new では挙動が異なります。
例えば return を行った場合、lambda では手続きオブジェクト自身を抜けますが、
Proc
.new では手続きオブジェクトを囲むメソッドを抜けます。

//emlist[例][ruby]{
def test_proc
f = Proc.new { retur...

Kernel.#lambda { ... } -> Proc (21414.0)

与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。

...与えられたブロックから手続きオブジェクト (Proc のインスタンス)
を生成して返します。Proc.new に近い働きをします。

ブロックが指定されなければ、呼び出し元のメソッドで指定されたブロック
を手続きオブジェクトと...
...k }
//}

//emlist[LocalJumpError が発生します。][ruby]{
pr = Proc.new { break }
(1..5).each(&pr)
//}

===[a:lambda_proc] lambda と proc Proc.new とイテレータの違い

Kernel
.#lambda と Proc.new はどちらも Proc クラスのインスタンス(手続きオブジェクト)を生...
...lambda と Proc.new では挙動が異なります。
例えば return を行った場合、lambda では手続きオブジェクト自身を抜けますが、
Proc
.new では手続きオブジェクトを囲むメソッドを抜けます。

//emlist[例][ruby]{
def test_proc
f = Proc.new { retur...
...与えられたブロックから手続きオブジェクト (Proc のインスタンス)
を生成して返します。Proc.new に近い働きをします。


また、lambda に & 引数を渡すのは推奨されません。& 引数ではなくてブロック記法で記述する必要があ...

Shell::CommandProcessor#test(command, file1, file2 = nil) -> bool | Time | Integer | nil (18157.0)

Kernel.#test や FileTest のメソッドに処理を委譲します。

...
Kernel
.#test や FileTest のメソッドに処理を委譲します。

@param command 数値、またはサイズが 1 の文字列の場合は Kernel.#test に処理委譲します。
2 文字以上の文字列の場合は FileTest のメソッドとして実行します。

@para...
...ell'
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"] # => true
p sh[:exists?, "foo"] # => true
p sh["exists?", "foo"] # => true

@see Kernel.#test, FileTest...

手続きオブジェクトの挙動の詳細 (3268.0)

手続きオブジェクトの挙動の詳細 * def * should_use_next * block * lambda_proc * orphan

...e_next
* block
* lambda_proc
* orphan

===[a:def] 手続きオブジェクトとは

手続きオブジェクトとはブロックをコンテキスト(ローカル変数のスコープやスタックフレーム)と
ともにオブジェクトにしたものです。Proc クラスのインスタ...
...k }
//}

//emlist[LocalJumpError が発生します。][ruby]{
pr = Proc.new { break }
(1..5).each(&pr)
//}

===[a:lambda_proc] lambda と proc Proc.new とイテレータの違い

Kernel
.#lambda と Proc.new はどちらも Proc クラスのインスタンス(手続きオブジェクト)を生...
...lambda と Proc.new では挙動が異なります。
例えば return を行った場合、lambda では手続きオブジェクト自身を抜けますが、
Proc
.new では手続きオブジェクトを囲むメソッドを抜けます。

//emlist[例][ruby]{
def test_proc
f = Proc.new { retur...

Shell::CommandProcessor#[](command, file1, file2 = nil) -> bool | Time | Integer | nil (3057.0)

Kernel.#test や FileTest のメソッドに処理を委譲します。

...
Kernel
.#test や FileTest のメソッドに処理を委譲します。

@param command 数値、またはサイズが 1 の文字列の場合は Kernel.#test に処理委譲します。
2 文字以上の文字列の場合は FileTest のメソッドとして実行します。

@para...
...ell'
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"] # => true
p sh[:exists?, "foo"] # => true
p sh["exists?", "foo"] # => true

@see Kernel.#test, FileTest...

絞り込み条件を変える

MiniTest::Assertions#assert_throws(tag, message = nil) { ... } -> true (3052.0)

与えられたブロックを評価中に、与えられたタグが Kernel.#throw された場合、検査にパスしたことになります。

...与えられたブロックを評価中に、与えられたタグが Kernel.#throw された場合、検査にパスしたことになります。

@param tag 与えられたブロック評価中に Kernel.#throw されるタグを任意のオブジェクトとして指定します。

@param mess...
...ージを指定します。
文字列か Proc を指定します。Proc である場合は Proc#call した
結果を使用します。

@raise MiniTest::Assertion 与えられたタグが Kernel.#throw されなかった場合に発生します。

@see Kernel.#throw...

NEWS for Ruby 2.7.0 (126.0)

NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...==== ブロックなしの proc/lambda が deprecated

* ブロック付きで呼び出されたメソッドの中で、ブロックなしでProc.newやKernel#proc
呼び出すと警告が表示されるようになりました。

//emlist[][ruby]{
def foo
proc

end
foo { puts "Hello" }...
...#=> warning: Capturing the given block using Kernel#proc is deprecated; use `&block` instead
//}

* 非推奨に関する警告を止めたい場合は、コマンドライン引数に
「-W:no-deprecated」を指定するか、コードの中で
「Warning[:deprecated] = false」
...
...16256

//emlist[test.rb][ruby]{
require "optparse"
OptionParser.new do |opts|
opts.on("-f", "--foo", "foo") {|v| }
opts.on("-b", "--bar", "bar") {|v| }
opts.on("-c", "--baz", "baz") {|v| }
end.parse!
//}

//emlist{
$ ruby test.rb --baa
Traceback (most recent call last):
test
.rb:7:in `<main>':...

NEWS for Ruby 3.0.0 (126.0)

NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...ror or different behavior. 14183
* Procs accepting a single rest argument and keywords are no longer
subject to autosplatting. This now matches the behavior of Procs
accepting a single rest argument and no keywords.
16166

//emlist[][ruby]{
pr = proc{|*a, **kw| [a, kw]}

pr.call([1])...
...`true` will cause compaction to occur during major collections. At the moment, compaction adds significant overhead to major collections, so please test first! 17176
* Hash
* Hash#transform_keys and Hash#transform_keys! now accept a hash that maps keys to new keys. 16274
* Hash#except h...
...wait(io, events, timeout)` in a non-blocking execution context. 16786
* Kernel
* Kernel#clone when called with the `freeze: false` keyword will call `#initialize_clone` with the `freeze: false` keyword. 14266
* Kernel#clone when called with the `freeze: true` keyword will call `#initialize...

クラス/メソッドの定義 (102.0)

クラス/メソッドの定義 * クラス/メソッドの定義: * class * singleton_class * module * method * operator * nest_method * eval_method * singleton_method * class_method * limit * 定義に関する操作: * alias * undef * defined

...imit
* 定義に関する操作:
* alias
* undef
* defined

===[a:class] クラス定義

//emlist[例][ruby]{
class Foo < Super
def test
# ...
end
# ...
end
//}

文法:

class 識別子 [`<' superclass ]
式..
end

文法:

class...
...が手続きオブジェクト(Proc)としてこの引数に格納されます。これは、
イテレータを定義する方法の一つです。イテレータを定義する代表的な方法は
yield を呼び出すことです。
他に Proc.new/Kernel.#proc を使う方法などもありま...
...ブロック引数の値はnilです。

//emlist[例][ruby]{
def foo(cnt, &block_arg)
cnt.times { block_arg.call } # ブロックに収まったProcオブジェクトはcallで実行
end
foo(3) { print "Ruby! " } #=> Ruby! Ruby! Ruby!
//}

メソッド定義において、仮引数はその種類...

Ruby用語集 (90.0)

Ruby用語集 A B C D E F G I J M N O R S Y

...オブジェクトの仮引数の数、および
ブロックやそれをオブジェクト化した Proc オブジェクトの
ブロックパラメーターの数。

Method#arity や Proc#arity で得ることができる。

引数などの数が 1 個、2 個、3 個であることを...
...る時点において、そこに至るメソッド呼び出し元情報を遡るデータ。
バックトレースともいう。

Kernel
.#caller_locations、Kernel.#caller で現時点までの
スタックトレースを得ることができる。

また、例外オブジェクトは例...
...よっては「即値」という用語を「リテラル」の意味で使うので注意されたい。

: ソフトウェアテスト
: software testing
プログラムの正しさや性能を調べること。単に「テスト」ともいう。
狭義にはテスト用プログラム(テ...

絞り込み条件を変える

<< 1 2 > >>