るりまサーチ

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

別のキーワード

  1. _builtin to_s
  2. openssl to_der
  3. openssl to_s
  4. _builtin to_a
  5. openssl to_pem

検索結果

Symbol#to_proc -> Proc (18125.0)

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

...びだします。


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

//emlist[暗黙に呼ばれる例][ruby]{
# メソッドに & とともにシンボルを渡すと
# to_proc が呼ばれて Proc 化され、
# それがブロックとし...
.../emlist[][ruby]{
:object_id.to_proc.lambda? # => true
//}

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

//emlist[暗黙に呼ばれる例][ruby]{
# メソッドに & とともにシンボルを渡すと
# to_proc が呼ばれて Proc 化さ...

メソッド呼び出し(super・ブロック付き・yield) (168.0)

メソッド呼び出し(super・ブロック付き・yield) * super * block * yield * block_arg * numbered_parameters * call_method

...ている
# => 1
# 2
# 3
//}

to_proc
メソッドを持つオブジェクトならば、`&'
修飾した引数として渡すことができます。デフォルトで Proc、Method オブジェ
クトは共に to_proc メソッドを持ちます。to_proc はメソッド呼び出し時に実...
...行され、Proc オブジェクトを返すことが期待されます。

//emlist[][ruby]{
class Foo
def to_proc
Proc.new {|v| p v}
end
end

[1,2,3].each(&Foo.new)
# => 1
# 2
# 3
//}

ブロック付きメソッドの戻り値は、通常のメソッドと同様ですが、ブロ...

NEWS for Ruby 3.0.0 (24.0)

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

...`# frozen-string-literal: true` is used. 17104
* Magic comment `shareable_constant_value` added to freeze constants.
See {Magic Comments}[rdoc-ref:doc/syntax/comments.rdoc@Magic+Comments] for more details.
17273
* A {static analysis}[rdoc-label:label-Static+analysis] foundation is
in...
...r hooks in a non-blocking context. 16786
* Ractor
* New class added to enable parallel execution. See rdoc-ref:ractor.md for more details.
* Random
* `Random::DEFAULT` now refers to the `Random` class instead of being a `Random` instance, so it can work with `Ractor`. 17322
* `Random...
...#sub
* String#succ / String#next
* String#swapcase
* String#tr
* String#tr_s
* String#upcase
* Symbol
* Symbol#to_proc now returns a lambda Proc. 16260
* Symbol#name has been added, which returns the name of the symbol if it is named. The returned string is...