るりまサーチ

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

別のキーワード

  1. kernel $-l
  2. matrix l
  3. _builtin $-l
  4. lupdecomposition l
  5. l matrix

ライブラリ

クラス

モジュール

検索結果

Enumerable#chunk {|elt| ... } -> Enumerator (21261.0)

要素を前から順にブロックで評価し、その結果によって 要素をチャンクに分けた(グループ化した)要素を持つ Enumerator を返します。

...ます。

//emlist[][ruby]{
enum.chunk {|elt| key }.each {|key, ary| do_something }
//}

例として、整数列を連続する奇数/偶数に分ける例を見てみます。
「n.even?」の値が切り替わるところで区切られているのがわかるでしょう。

//emlist[例][ruby]...
...{
[3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5].chunk {|n|
n.even?
}.each {|even, ary|
p [even, ary]
}
# => [false, [3, 1]]
# [true, [4]]
# [false, [1, 5, 9]]
# [true, [2, 6]]
# [false, [5, 3, 5]]
//}

このメソッドは各要素が既にソートされている場合に便利です。

...
...ています。
このファイルは、Linux や macOS などで、ソートされた英語(など)の単語の
リストを改行で区切って収めたものです。
大文字/小文字の違いを無視するため upcase しています。

//emlist[例][ruby]{
# ファイルのエン...

Enumerator::Lazy#chunk {|elt| ... } -> Enumerator::Lazy (21254.0)

Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。

...rable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。

//emlist[例][ruby]{
1.step.lazy.chunk{ |n| n % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007f8bf18118f0>:each>>

1.step.lazy.chunk{ |n| n % 3 == 0 }.take(5).force
# => [[false, [...
...1, 2]], [true, [3]], [false, [4, 5]], [true, [6]], [false, [7, 8]]]
//}

@see Enumerable#chunk...

Enumerator::Lazy#chunk(initial_state) {|elt, state| ... } -> Enumerator::Lazy (21254.0)

Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。

...rable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。

//emlist[例][ruby]{
1.step.lazy.chunk{ |n| n % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007f8bf18118f0>:each>>

1.step.lazy.chunk{ |n| n % 3 == 0 }.take(5).force
# => [[false, [...
...1, 2]], [true, [3]], [false, [4, 5]], [true, [6]], [false, [7, 8]]]
//}

@see Enumerable#chunk...

Net::HTTPHeader#chunked? -> bool (6206.0)

Transfer-Encoding: ヘッダフィールドが "chunked" である 場合に真を返します。

...ルドが "chunked" である
場合に真を返します。

Transfer-Encoding: ヘッダフィールドが存在しなかったり、
"chunked" 以外である場合には偽を返します。

//emlist[例][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
req = Net:...
...:HTTP::Get.new(uri.request_uri)
req.chunked? # => false
req["Transfer-Encoding"] = "chunked"
req.chunked? # => true
//}...