66件ヒット
[1-66件を表示]
(0.014秒)
種類
- インスタンスメソッド (48)
- 文書 (12)
- 特異メソッド (6)
ライブラリ
- ビルトイン (54)
クラス
- Enumerator (6)
モジュール
- Enumerable (48)
キーワード
-
NEWS for Ruby 2
. 0 . 0 (12) - produce (6)
検索結果
先頭5件
-
Enumerable
# detect(ifnone = nil) -> Enumerator (18122.0) -
要素に対してブロックを評価した値が真になった最初の要素を返します。
...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" }
p [1, 2, 3, 4, 5].find(ifnone) {|i| i % 7 == 0 }
# ArgumentError: item not... -
Enumerable
# detect(ifnone = nil) {|item| . . . } -> object (18122.0) -
要素に対してブロックを評価した値が真になった最初の要素を返します。
...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" }
p [1, 2, 3, 4, 5].find(ifnone) {|i| i % 7 == 0 }
# ArgumentError: item not... -
Enumerable
# find(ifnone = nil) -> Enumerator (18122.0) -
要素に対してブロックを評価した値が真になった最初の要素を返します。
...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" }
p [1, 2, 3, 4, 5].find(ifnone) {|i| i % 7 == 0 }
# ArgumentError: item not... -
Enumerable
# find(ifnone = nil) {|item| . . . } -> object (18122.0) -
要素に対してブロックを評価した値が真になった最初の要素を返します。
...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" }
p [1, 2, 3, 4, 5].find(ifnone) {|i| i % 7 == 0 }
# ArgumentError: item not... -
Enumerator
. produce(initial = nil) { |prev| . . . } -> Enumerator (18.0) -
与えられたブロックを呼び出し続ける、停止しない Enumerator を返します。 ブロックの戻り値が、次にブロックを呼び出す時に引数として渡されます。 initial 引数が渡された場合、最初にブロックを呼び出す時にそれがブロック 呼び出しの引数として渡されます。initial が渡されなかった場合は nil が 渡されます。
...ration }
enclosing_section = ancestors.find { |n| n.type == :section }
//}
このメソッドは Enumerable の各メソッドと組み合わせて使うことで、
while や until ループのような処理を実装できます。
例えば Enumerable#detect, Enumerable#slice_after, Enumerable#t......ist[Enumerable のメソッドと組み合わせる例][ruby]{
# 次の火曜日を返す例
require "date"
Enumerator.produce(Date.today, &:succ).detect(&:tuesday?)
# シンプルなレキサーの例
require "strscan"
scanner = StringScanner.new("7+38/6")
PATTERN = %r{\d+|[-/+*]}
Enumerator.produ... -
NEWS for Ruby 2
. 0 . 0 (12.0) -
NEWS for Ruby 2.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...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......r the Next Protocol Negotiation extension. Supported
with OpenSSL 1.0.1 and higher.
* OpenSSL::OPENSSL_FIPS allows client applications to detect whether OpenSSL
is FIPS-enabled. OpenSSL.fips_mode= allows turning on and off FIPS mode
manually in order to adapt to situations wher......* 拡張: OpenStruct.new OpenStruct/Struct のインスタンスを受け付けるようになりました
* pathname
* 拡張: Pathname#find ブロックを与えない場合 Enumerator を返すようになりました
* rake
* 0.9.5 に更新
* This version is backwards-co...