るりまサーチ

最速Rubyリファレンスマニュアル検索!
118件ヒット [1-100件を表示] (0.137秒)

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 > >>

Enumerable#take(n) -> Array (26120.0)

Enumerable オブジェクトの先頭から n 要素を配列として返します。

...Enumerable オブジェクトの先頭から n 要素を配列として返します。

@param n 要素数を指定します。

//emlist[例][ruby]{
e = [1, 2, 3, 4, 5, 0].each
e.take(3) # => [1, 2, 3]
//}

@see Array#take...

Enumerable#take_while -> Enumerator (14121.0)

Enumerable オブジェクトの要素を順に偽になるまでブロックで評価します。 最初に偽になった要素の手前の要素までを配列として返します。

...クで評価します。
最初に偽になった要素の手前の要素までを配列として返します。

//emlist[例][ruby]{
e = [1, 2, 3, 4, 5, 0].each
e.take_while {|i| i < 3 } # => [1, 2]
//}

ブロックを省略した場合は Enumerator を返します。

@see Array#take_while...

Enumerable#take_while {|element| ... } -> Array (14121.0)

Enumerable オブジェクトの要素を順に偽になるまでブロックで評価します。 最初に偽になった要素の手前の要素までを配列として返します。

...クで評価します。
最初に偽になった要素の手前の要素までを配列として返します。

//emlist[例][ruby]{
e = [1, 2, 3, 4, 5, 0].each
e.take_while {|i| i < 3 } # => [1, 2]
//}

ブロックを省略した場合は Enumerator を返します。

@see Array#take_while...

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

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

...t[例][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 (8013.0)

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

...t[例][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#slice_after {|elt| bool } -> Enumerator::Lazy (8013.0)

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

...][ruby]{
1.step.lazy.slice_after { |e| e % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007fd73980e6f8>:each>>

1.step.lazy.slice_after { |e| e % 3 == 0 }.take(5).force
# => [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]]
//}

@see Enumerable#slice_after...

Enumerator::Lazy#slice_after(pattern) -> Enumerator::Lazy (8013.0)

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

...][ruby]{
1.step.lazy.slice_after { |e| e % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007fd73980e6f8>:each>>

1.step.lazy.slice_after { |e| e % 3 == 0 }.take(5).force
# => [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]]
//}

@see Enumerable#slice_after...

Enumerator::Lazy#slice_before {|elt| bool } -> Enumerator::Lazy (8013.0)

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

...][ruby]{
1.step.lazy.slice_before { |e| e.even? }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007f9f31844ce8>:each>>

1.step.lazy.slice_before { |e| e % 3 == 0 }.take(5).force
# => [[1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11], [12, 13, 14]]
//}

@see Enumerable#slice_before...
...例][ruby]{
1.step.lazy.slice_before { |e| e.even? }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007f9f31844ce8>:each>>

1.step.lazy.slice_before { |e| e % 3 == 0 }.take(5).force
# => [[1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11], [12, 13, 14]]
//}

@see Enumerable#slice_before...

Enumerator::Lazy#slice_before(initial_state) {|elt, state| bool } -> Enumerator::Lazy (8013.0)

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

...][ruby]{
1.step.lazy.slice_before { |e| e.even? }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007f9f31844ce8>:each>>

1.step.lazy.slice_before { |e| e % 3 == 0 }.take(5).force
# => [[1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11], [12, 13, 14]]
//}

@see Enumerable#slice_before...
...例][ruby]{
1.step.lazy.slice_before { |e| e.even? }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007f9f31844ce8>:each>>

1.step.lazy.slice_before { |e| e % 3 == 0 }.take(5).force
# => [[1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11], [12, 13, 14]]
//}

@see Enumerable#slice_before...

Enumerator::Lazy#slice_before(pattern) -> Enumerator::Lazy (8013.0)

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

...][ruby]{
1.step.lazy.slice_before { |e| e.even? }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007f9f31844ce8>:each>>

1.step.lazy.slice_before { |e| e % 3 == 0 }.take(5).force
# => [[1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11], [12, 13, 14]]
//}

@see Enumerable#slice_before...
...例][ruby]{
1.step.lazy.slice_before { |e| e.even? }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007f9f31844ce8>:each>>

1.step.lazy.slice_before { |e| e % 3 == 0 }.take(5).force
# => [[1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11], [12, 13, 14]]
//}

@see Enumerable#slice_before...

絞り込み条件を変える

<< 1 2 > >>