るりまサーチ

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

別のキーワード

  1. _builtin step
  2. numeric step
  3. date step
  4. range step
  5. step

ライブラリ

クラス

キーワード

検索結果

<< 1 2 3 > >>

Enumerator::Lazy#force(*args) -> [object] (18119.0)

全ての要素を含む配列を返します。Lazy から実際に値を取り出すのに使います。

...要素を含む配列を返します。Lazy から実際に値を取り出すのに使います。

Enumerable#to_a のエイリアスです。

//emlist[例][ruby]{
1.step.lazy.take(10).force
# => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

1.step.lazy.take(10).to_a
# => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
//}...

Enumerator::Lazy#collect {|item| ... } -> Enumerator::Lazy (24.0)

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

...クを指定しなかった場合に発生します。

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

1.step.lazy.collect{ |n| n.succ }.take(10).force
# => [2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
//}

@see Enumerable#map...

Enumerator::Lazy#drop(n) -> Enumerator::Lazy (24.0)

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

...@raise ArgumentError n に負の数を指定した場合に発生します。

//emlist[例][ruby]{
1.step.lazy.drop(3)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:drop(3)>

1.step.lazy.drop(3).take(10).force
# => [4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
//}

@see Enumerable#drop...

Enumerator::Lazy#drop_while {|item| ... } -> Enumerator::Lazy (24.0)

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

...なくEnumerator::Lazy を返します。

//emlist[例][ruby]{
1.step.lazy.drop_while { |i| i < 42 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:drop_while>

1.step.lazy.drop_while { |i| i < 42 }.take(10).force
# => [42, 43, 44, 45, 46, 47, 48, 49, 50, 51]
//}

@see Enumerab...

Enumerator::Lazy#filter {|item| ... } -> Enumerator::Lazy (24.0)

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

...しなかった場合に発生します。

//emlist[例][ruby]{
1.step.lazy.find_all { |i| i.even? }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:find_all>

1.step.lazy.select { |i| i.even? }.take(10).force
# => [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
//}

@see Enumerable#select...

絞り込み条件を変える

Enumerator::Lazy#filter_map {|item| ... } -> Enumerator::Lazy (24.0)

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

...かった場合に発生します。

//emlist[例][ruby]{
1.step.lazy.filter_map { |n| n * 2 if n.even? }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: (1.step)>:filter_map>

1.step.lazy.filter_map { |n| n * 2 if n.even? }.take(10).force
# => [4, 8, 12, 16, 20, 24, 28, 32, 36, 40]
//}

@see Enumerab...

Enumerator::Lazy#find_all {|item| ... } -> Enumerator::Lazy (24.0)

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

...しなかった場合に発生します。

//emlist[例][ruby]{
1.step.lazy.find_all { |i| i.even? }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:find_all>

1.step.lazy.select { |i| i.even? }.take(10).force
# => [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
//}

@see Enumerable#select...

Enumerator::Lazy#map {|item| ... } -> Enumerator::Lazy (24.0)

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

...クを指定しなかった場合に発生します。

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

1.step.lazy.collect{ |n| n.succ }.take(10).force
# => [2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
//}

@see Enumerable#map...

Enumerator::Lazy#reject {|item| ... } -> Enumerator::Lazy (24.0)

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

...定しなかった場合に発生します。

//emlist[例][ruby]{
1.step.lazy.reject { |i| i.even? }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:reject>

1.step.lazy.reject { |i| i.even? }.take(10).force
# => [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]
//}

@see Enumerable#reject...

Enumerator::Lazy#select {|item| ... } -> Enumerator::Lazy (24.0)

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

...しなかった場合に発生します。

//emlist[例][ruby]{
1.step.lazy.find_all { |i| i.even? }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:find_all>

1.step.lazy.select { |i| i.even? }.take(10).force
# => [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
//}

@see Enumerable#select...

絞り込み条件を変える

Enumerator::Lazy#take(n) -> Enumerator::Lazy (24.0)

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

...数を指定します。

@raise ArgumentError n に負の数を指定した場合に発生します。

//emlist[例][ruby]{
1.step.lazy.take(5)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:take(5)>

1.step.lazy.take(5).force
# => [1, 2, 3, 4, 5]
//}

@see Enumerable#take...
<< 1 2 3 > >>