るりまサーチ

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

別のキーワード

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

検索結果

<< 1 2 3 ... > >>

Kernel.#proc -> Proc (15650.0)

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

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

ブロックが指定されなければ、呼び出し元のメソッドで指定されたブロック
を手続きオブジェクトと...
...te 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...
...ことを意図されているため、例外 LocalJumpError は発生しません。

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

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

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

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

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

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

ブロックが指定されなければ、呼び出し元のメソッドで指定されたブロック
を手続きオブジェクトと...
...te 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...
...ことを意図されているため、例外 LocalJumpError は発生しません。

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

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

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

Kernel.#proc -> Proc (15649.0)

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

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

ブロックが指定されなければ、呼び出し元のメソッドで指定されたブロック
を手続きオブジェクトと...
...te 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...
...ことを意図されているため、例外 LocalJumpError は発生しません。

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

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

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

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

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

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

ブロックが指定されなければ、呼び出し元のメソッドで指定されたブロック
を手続きオブジェクトと...
...te 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...
...ことを意図されているため、例外 LocalJumpError は発生しません。

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

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

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


また、lambda に & 引数を渡すのは推奨されません。& 引数ではなくてブロック記法で記述する必要があ...
...eral block is deprecated; use the proc without lambda instead」
を出力します。

@raise ArgumentError ブロックを省略した呼び出しを行ったときに発生します。

//emlist[例][ruby]{
def foo &block
lambda(&block)
end

it = foo{p 12}
it.call #=> 12
//}

@see Proc,Proc.new...
...teral block is deprecated; use the proc without lambda instead」
を出力します。

@raise ArgumentError ブロックを省略した呼び出しを行ったときに発生します。

//emlist[例][ruby]{
def foo &block
proc
(&block)
end

it = foo{p 12}
it.call #=> 12
//}

@see Proc,Proc.new...

Proc#ruby2_keywords -> proc (9289.0)

Marks the proc as passing keywords through a normal argument splat. This should only be called on procs that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the proc such that if the proc is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the proc to other methods.

...Marks the proc as passing keywords through a normal argument splat. This
should only be called on procs that accept an argument splat (`*args`)
but not explicit keywords or a keyword splat. It marks the proc such
that if the proc is called with keyword arguments, the final hash
argument is marked...
...ck that the proc responds to this method before calling
it. Also, be aware that if this method is removed, the behavior of the
proc
will change so that it does not pass through keywords.

//emlist[][ruby]{
module Mod
foo = ->(meth, *args, &block) do
send(:"do_#{meth}", *args, &block)
end
f...

絞り込み条件を変える

Proc.new -> Proc (9280.0)

ブロックをコンテキストとともにオブジェクト化して返します。

...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)
が発生します。

ブロックを指定しなければ、このメ...
...ソッドを呼び出したメソッドが
ブロックを伴うときに、それを Proc オブジェクトとして生成して返します。

ただし、ブロックを指定しない呼び出しは推奨されていません。呼び出し元のメソッドで指定されたブロック
...
...entError が発生します。

//emlist[例][ruby]{
def foo
Proc
.new
end
foo
# => -:2:in `new': tried to create Proc object without a block (ArgumentError)
# from -:2:in `foo'
# from -:4:in `<main>'
//}

Proc
.new は、Proc#initialize が定義されていれば
オブジェクト...

Proc.new { ... } -> Proc (9280.0)

ブロックをコンテキストとともにオブジェクト化して返します。

...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)
が発生します。

ブロックを指定しなければ、このメ...
...ソッドを呼び出したメソッドが
ブロックを伴うときに、それを Proc オブジェクトとして生成して返します。

ただし、ブロックを指定しない呼び出しは推奨されていません。呼び出し元のメソッドで指定されたブロック
...
...entError が発生します。

//emlist[例][ruby]{
def foo
Proc
.new
end
foo
# => -:2:in `new': tried to create Proc object without a block (ArgumentError)
# from -:2:in `foo'
# from -:4:in `<main>'
//}

Proc
.new は、Proc#initialize が定義されていれば
オブジェクト...
...行ったときに発生します。

//emlist[][ruby]{
pr = Proc.new {|arg| p arg }
pr.call(1) # => 1
//}

//emlist[][ruby]{
Proc
.new # => -e:1:in `new': tried to create Proc object without a block (ArgumentError)
//}

Proc
.new は、Proc#initialize が定義されていれば
オブジェクトの...
...初期化のためにこれを呼び出します。このことを
除けば、Kernel.#proc と同じです。...

Shell::ProcessController.block_output_synchronize { ... } -> () (9201.0)

@todo

@todo

Shell::CommandProcessor#blockdev?(file) -> bool (9200.0)

FileTest モジュールにある同名のクラスメソッドと同じです.

...FileTest モジュールにある同名のクラスメソッドと同じです.

@param file ファイル名を表す文字列か IO オブジェクトを指定します。

@see FileTest.#blockdev?...

Proc#parameters(lambda: nil) -> [object] (9152.0)

Proc オブジェクトの引数の情報を返します。

...Proc オブジェクトの引数の情報を返します。

Proc
オブジェクトが引数を取らなければ空の配列を返します。引数を取る場合は、配列の配列を返し、
各配列の要素は引数の種類に対応した以下のような Symbol と、引数名を表す...
...ド引数
: :keyrest
** で指定された残りのキーワード引数
: :block
& で指定されたブロック引数

@param lambda true なら lambda として扱ったとき、false なら lambda ではない Proc として
扱ったときの引数の情報を返します。

/...
...:key, :k_y], [:keyrest, :k_other], [:block, :b
//}

//emlist[lambda: の例][ruby]{
prc = proc{|x, y=42, *other|}
p prc.parameters # => x], [:opt, :y], [:rest, :other
prc = lambda{|x, y=42, *other|}
p prc.parameters # => x], [:opt, :y], [:rest, :other
prc = proc{|x, y=42, *other|}
p prc.parameters...

絞り込み条件を変える

Proc#parameters -> [object] (9134.0)

Proc オブジェクトの引数の情報を返します。

...Proc オブジェクトの引数の情報を返します。

Proc
オブジェクトが引数を取らなければ空の配列を返します。引数を取る場合は、配列の配列を返し、
各配列の要素は引数の種類に対応した以下のような Symbol と、引数名を表す...
...のキーワード引数
: :block
& で指定されたブロック引数


//emlist[例][ruby]{
prc = lambda{|x, y=42, *other, k_x:, k_y: 42, **k_other, &b|}
prc.parameters #=> x], [:opt, :y], [:rest, :other], [:keyreq, :k_x], [:key, :k_y], [:keyrest, :k_other], [:block, :b
//}


@see Method#parame...

Symbol#to_proc -> Proc (6372.0)

self に対応する Proc オブジェクトを返します。

...self に対応する Proc オブジェクトを返します。

生成される Proc オブジェクトを呼びだす(Proc#call)と、
Proc
#callの第一引数をレシーバとして、 self という名前のメソッドを
残りの引数を渡して呼びだします。


//emlist[明示的に...
...呼ぶ例][ruby]{
:to_i.to_proc["ff", 16] # => 255 ← "ff".to_i(16)と同じ
//}

//emlist[暗黙に呼ばれる例][ruby]{
# メソッドに & とともにシンボルを渡すと
# to_proc が呼ばれて Proc 化され、
# それがブロックとして渡される。
(1..3).collect(&:to_s) #...
...=> ["1", "2", "3"]
(1..3).select(&:odd?) # => [1, 3]
//}

@see d:spec/call#block...
...対応する Proc オブジェクトを返します。

生成される Proc オブジェクトを呼びだす(Proc#call)と、
Proc
#callの第一引数をレシーバとして、 self という名前のメソッドを
残りの引数を渡して呼びだします。

生成される Proc オブジ...
...by]{
:object_id.to_proc.lambda? # => true
//}

//emlist[明示的に呼ぶ例][ruby]{
:to_i.to_proc["ff", 16] # => 255 ← "ff".to_i(16)と同じ
//}

//emlist[暗黙に呼ばれる例][ruby]{
# メソッドに & とともにシンボルを渡すと
# to_proc が呼ばれて Proc 化され、
# そ...
...れがブロックとして渡される。
(1..3).collect(&:to_s) # => ["1", "2", "3"]
(1..3).select(&:odd?) # => [1, 3]
//}

@see d:spec/call#block...

Hash#default_proc -> Proc | nil (6348.0)

ハッシュのデフォルト値を返す Proc オブジェクトを返します。 ハッシュがブロック形式のデフォルト値を持たない場合 nil を返します。

... Proc オブジェクトを返します。
ハッシュがブロック形式のデフォルト値を持たない場合 nil を返します。

//emlist[例][ruby]{
h = Hash.new {|hash, key| "The #{key} not exist in #{hash.inspect}"}
p h.default #=> nil
p block = h.default_proc #=> #<...
...Proc:0x0x401a9ff4>
p block.call({},:foo) #=> "The foo not exist in {}"

h = Hash.new("default")
p h.default #=> "default"
p h.default_proc #=> nil
//}

@see Hash#default...

Proc (6252.0)

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

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

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

Proc
がローカル変数のスコープ...
...では Proc#call)
へジャンプし値を返すには next を使います。break や return ではありません。


//emlist[例][ruby]{
def foo
f = Proc.new{
next 1
2 # この行に到達することはない
}
end

p foo().call #=> 1
//}

===[a:block] Proc...
...ことを意図されているため、例外 LocalJumpError は発生しません。

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

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

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

MiniTest::Assertions#assert_block(message = nil) { ... } -> true (6219.0)

与えられたブロックの評価結果が真である場合、検査にパスしたことになります。

...@param message 検査に失敗した場合に表示するメッセージを指定します。
文字列か Proc を指定します。Proc である場合は Proc#call した
結果を使用します。

@raise MiniTest::Assertion 与えられたブロックの評価...

絞り込み条件を変える

ruby 1.6 feature (5304.0)

ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。

...((<stable-snapshot|URL:ftp://ftp.netlab.co.jp/pub/lang/ruby/stable-snapshot.tar.gz>)) は、日々更新される安定版の最新ソースです。

== 1.6.8 (2002-12-24) -> stable-snapshot

: 2003-01-22: errno

EAGAIN と EWOULDBLOCK が同じ値のシステムで、EWOULDBLOCK がなくな...
...LDBLOCK は、EAGAIN
として定義されています。(これは 1.6.7 とは異なる挙動です)

p Errno::EAGAIN
p Errno::EWOULDBLOCK

=> ruby 1.6.7 (2002-03-01) [i586-linux]
Errno::EAGAIN
Errno::EWOULDBLOCK

=> ruby 1.6.8 (2002-12-24...
...i586-linux]
#<MatchData:0x401b1c98>
nil

: 2002-03-25 ((<BasicSocket/BasicSocket.do_not_reverse_lookup>))

$SAFE > 3 で値を設定できなくなりました。
((<ruby-dev:16554>))

: 2002-03-23 IO#((<IO/read>))

サイズが 0 で中身のあるファイル(Linux の /proc...
<< 1 2 3 ... > >>