るりまサーチ

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

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method gets
  4. irb/input-method new
  5. matrix -

種類

ライブラリ

モジュール

検索結果

Proc (38222.0)

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

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

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

Proc
がローカル変数のスコープ...
...ruby]{
def test_proc
f = Proc.new { return :from_proc }
f.call
return :from_method
end

def test_lambda
f = lambda { return :from_lambda }
f.call
return :from_method
end

def test_block
tap
{ return :from_block }
return :from_method
end

p test_proc() #=> :from_proc
p test_lambda()...
...ことを意図されているため、例外 LocalJumpError は発生しません。

//emlist[例][ruby]{
def foo
Proc
.new { return }
end

foo.call
# => in `call': return from proc-closure (LocalJumpError)
//}

以下の表は、手続きオブジェクトの実行を上の例と同じように...

Kernel.#proc -> Proc (3578.0)

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

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

ブロックが指定されなければ、呼び出し元のメソッドで指定されたブロック
を手続きオブジェクトと...
...ruby]{
def test_proc
f = Proc.new { return :from_proc }
f.call
return :from_method
end

def test_lambda
f = lambda { return :from_lambda }
f.call
return :from_method
end

def test_block
tap
{ return :from_block }
return :from_method
end

p test_proc() #=> :from_proc
p test_lambda()...
...ことを意図されているため、例外 LocalJumpError は発生しません。

//emlist[例][ruby]{
def foo
Proc
.new { return }
end

foo.call
# => in `call': return from proc-closure (LocalJumpError)
//}

以下の表は、手続きオブジェクトの実行を上の例と同じように...

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

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

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

ブロックが指定されなければ、呼び出し元のメソッドで指定されたブロック
を手続きオブジェクトと...
...ruby]{
def test_proc
f = Proc.new { return :from_proc }
f.call
return :from_method
end

def test_lambda
f = lambda { return :from_lambda }
f.call
return :from_method
end

def test_block
tap
{ return :from_block }
return :from_method
end

p test_proc() #=> :from_proc
p test_lambda()...
...ことを意図されているため、例外 LocalJumpError は発生しません。

//emlist[例][ruby]{
def foo
Proc
.new { return }
end

foo.call
# => in `call': return from proc-closure (LocalJumpError)
//}

以下の表は、手続きオブジェクトの実行を上の例と同じように...

Kernel.#proc -> Proc (3577.0)

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

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

ブロックが指定されなければ、呼び出し元のメソッドで指定されたブロック
を手続きオブジェクトと...
...ruby]{
def test_proc
f = Proc.new { return :from_proc }
f.call
return :from_method
end

def test_lambda
f = lambda { return :from_lambda }
f.call
return :from_method
end

def test_block
tap
{ return :from_block }
return :from_method
end

p test_proc() #=> :from_proc
p test_lambda()...
...ことを意図されているため、例外 LocalJumpError は発生しません。

//emlist[例][ruby]{
def foo
Proc
.new { return }
end

foo.call
# => in `call': return from proc-closure (LocalJumpError)
//}

以下の表は、手続きオブジェクトの実行を上の例と同じように...

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

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

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

ブロックが指定されなければ、呼び出し元のメソッドで指定されたブロック
を手続きオブジェクトと...
...ruby]{
def test_proc
f = Proc.new { return :from_proc }
f.call
return :from_method
end

def test_lambda
f = lambda { return :from_lambda }
f.call
return :from_method
end

def test_block
tap
{ return :from_block }
return :from_method
end

p test_proc() #=> :from_proc
p test_lambda()...
...ことを意図されているため、例外 LocalJumpError は発生しません。

//emlist[例][ruby]{
def foo
Proc
.new { return }
end

foo.call
# => in `call': return from proc-closure (LocalJumpError)
//}

以下の表は、手続きオブジェクトの実行を上の例と同じように...
...与えられたブロックから手続きオブジェクト (Proc のインスタンス)
を生成して返します。Proc.new に近い働きをします。


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

絞り込み条件を変える

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

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

...e_next
* block
* lambda_proc
* orphan

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

手続きオブジェクトとはブロックをコンテキスト(ローカル変数のスコープやスタックフレーム)と
ともにオブジェクトにしたものです。Proc クラスのインスタ...
...ruby]{
def test_proc
f = Proc.new { return :from_proc }
f.call
return :from_method
end

def test_lambda
f = lambda { return :from_lambda }
f.call
return :from_method
end

def test_block
tap
{ return :from_block }
return :from_method
end

p test_proc() #=> :from_proc
p test_lambda()...
...ことを意図されているため、例外 LocalJumpError は発生しません。

//emlist[例][ruby]{
def foo
Proc
.new { return }
end

foo.call
# => in `call': return from proc-closure (LocalJumpError)
//}

以下の表は、手続きオブジェクトの実行を上の例と同じように...

Kernel.#lambda -> Proc (478.0)

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

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

ブロックが指定されなければ、呼び出し元のメソッドで指定されたブロック
を手続きオブジェクトと...
...ruby]{
def test_proc
f = Proc.new { return :from_proc }
f.call
return :from_method
end

def test_lambda
f = lambda { return :from_lambda }
f.call
return :from_method
end

def test_block
tap
{ return :from_block }
return :from_method
end

p test_proc() #=> :from_proc
p test_lambda()...
...ことを意図されているため、例外 LocalJumpError は発生しません。

//emlist[例][ruby]{
def foo
Proc
.new { return }
end

foo.call
# => in `call': return from proc-closure (LocalJumpError)
//}

以下の表は、手続きオブジェクトの実行を上の例と同じように...

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

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

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

ブロックが指定されなければ、呼び出し元のメソッドで指定されたブロック
を手続きオブジェクトと...
...ruby]{
def test_proc
f = Proc.new { return :from_proc }
f.call
return :from_method
end

def test_lambda
f = lambda { return :from_lambda }
f.call
return :from_method
end

def test_block
tap
{ return :from_block }
return :from_method
end

p test_proc() #=> :from_proc
p test_lambda()...
...ことを意図されているため、例外 LocalJumpError は発生しません。

//emlist[例][ruby]{
def foo
Proc
.new { return }
end

foo.call
# => in `call': return from proc-closure (LocalJumpError)
//}

以下の表は、手続きオブジェクトの実行を上の例と同じように...
...与えられたブロックから手続きオブジェクト (Proc のインスタンス)
を生成して返します。Proc.new に近い働きをします。


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