るりまサーチ

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

別のキーワード

  1. _builtin to_proc
  2. _builtin proc
  3. proc curry
  4. httpserver mount_proc
  5. readline completion_proc

ライブラリ

モジュール

キーワード

検索結果

Enumerable#detect(ifnone = nil) -> Enumerator (18114.0)

要素に対してブロックを評価した値が真になった最初の要素を返します。

...を持つオブジェクト (例えば Proc) を指定します。

//emlist[例][ruby]{
# 最初の 3 の倍数を探す
p [1, 2, 3, 4, 5].find {|i| i % 3 == 0 } # => 3
p [2, 2, 2, 2, 2].find {|i| i % 3 == 0 } # => nil

# ifnone の使用例
ifnone = proc { raise ArgumentError, "item not found"...

Enumerable#detect(ifnone = nil) {|item| ... } -> object (18114.0)

要素に対してブロックを評価した値が真になった最初の要素を返します。

...を持つオブジェクト (例えば Proc) を指定します。

//emlist[例][ruby]{
# 最初の 3 の倍数を探す
p [1, 2, 3, 4, 5].find {|i| i % 3 == 0 } # => 3
p [2, 2, 2, 2, 2].find {|i| i % 3 == 0 } # => nil

# ifnone の使用例
ifnone = proc { raise ArgumentError, "item not found"...

Enumerable#find(ifnone = nil) -> Enumerator (3014.0)

要素に対してブロックを評価した値が真になった最初の要素を返します。

...を持つオブジェクト (例えば Proc) を指定します。

//emlist[例][ruby]{
# 最初の 3 の倍数を探す
p [1, 2, 3, 4, 5].find {|i| i % 3 == 0 } # => 3
p [2, 2, 2, 2, 2].find {|i| i % 3 == 0 } # => nil

# ifnone の使用例
ifnone = proc { raise ArgumentError, "item not found"...

Enumerable#find(ifnone = nil) {|item| ... } -> object (3014.0)

要素に対してブロックを評価した値が真になった最初の要素を返します。

...を持つオブジェクト (例えば Proc) を指定します。

//emlist[例][ruby]{
# 最初の 3 の倍数を探す
p [1, 2, 3, 4, 5].find {|i| i % 3 == 0 } # => 3
p [2, 2, 2, 2, 2].find {|i| i % 3 == 0 } # => nil

# ifnone の使用例
ifnone = proc { raise ArgumentError, "item not found"...

NEWS for Ruby 2.7.0 (78.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」
...
...た。7877

//emlist[Enumerator.produce][ruby]{
require "date"
dates = Enumerator.produce(Date.today, &:succ) #=> infinite sequence of dates
dates.detect(&:tuesday?) #=> next Tuesday
//}
//emlist[Enumerator::Lazy#eager][ruby]{
a = %w(foo bar baz)
e = a.lazy.map {|x| x.upcase }.map {|x| x + "!" }.eag...

絞り込み条件を変える

NEWS for Ruby 2.0.0 (48.0)

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

...

* Hash
* 追加: Hash#to_h 明示的に変換するメソッドです。Array#to_a に似ています
* 拡張: Hash#default_proc= default proc をクリアするために nil を渡せるようになりました

* IO
* 非推奨: IO#lines, #bytes, #chars, #codepoints

* Kern...
...* ObjectSpace::WeakMap
* 弱い参照を保持するための低レベルのクラスです。

* Proc
* 非互換: Proc#== と #eql? を削除。

* Process
* 追加: Process#getsid session id を取得します(unix のみ)。

* Range
* 追加: Range#size サイズの...
...IO#wait_readable は IO#wait の別名です。

* json
* 1.7.7 に更新

* net/http
* 新機能
* Proxies are now automatically detected from the http_proxy environment
variable. See Net::HTTP.new for details.
* gzip and deflate compression are now requested for al...