るりまサーチ (Ruby 2.5.0)

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

別のキーワード

  1. _builtin grep
  2. _builtin grep_v
  3. enumerable grep_v
  4. enumerable grep
  5. lazy grep

クラス

モジュール

キーワード

検索結果

Enumerator::Lazy#grep_v(pattern) {|item| ... } -> Enumerator::Lazy (63853.0)

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

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

//emlist[例][ruby]{
(100..Float::INFINITY).lazy.map(&:to_s).grep_v(/(\d).*\1/)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: 100..Infinity>:map>:grep_v(/(\d).*\1/)>
(100..Float::INFINITY).lazy.map(&:to_s).grep_v(/(\d).*\1/).t...

Enumerator::Lazy#grep(pattern) {|item| ... } -> Enumerator::Lazy (9466.0)

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

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

//emlist[例][ruby]{
(100..Float::INFINITY).lazy.map(&:to_s).grep(/\A(\d)\1+\z/)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: 100..Infinity>:map>:grep(/\A(\d)\1+\z/)>
(100..Float::INFINITY).lazy.map(&:to_s).grep(/\A(\d)\1+\z/)....

Enumerator::Lazy (9115.0)

map や select などのメソッドの遅延評価版を提供するためのクラス。

map や select などのメソッドの遅延評価版を提供するためのクラス。

動作は通常の Enumerator と同じですが、以下のメソッドが遅延評価を行う
(つまり、配列ではなく Enumerator を返す) ように再定義されています。

* map/collect
* flat_map/collect_concat
* select/find_all
* reject
* grep, grep_v
* take, take_while
* drop, drop_while
* slice_before, slice_after, slice_when
* chunk...

Array#reject -> Enumerator (346.0)

各要素に対してブロックを評価し、 その値が偽であった要素を集めた新しい配列を返します。 条件を反転させた select です。

各要素に対してブロックを評価し、
その値が偽であった要素を集めた新しい配列を返します。
条件を反転させた select です。

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

//emlist[例][ruby]{
# 偶数を除外する (奇数を集める)
[1, 2, 3, 4, 5, 6].reject {|i| i % 2 == 0 } # => [1, 3, 5]
//}

@see Array#select, Enumerable#reject
@see Enumerable#grep_v

Enumerable#reject -> Enumerator (346.0)

各要素に対してブロックを評価し、 その値が偽であった要素を集めた新しい配列を返します。 条件を反転させた select です。

各要素に対してブロックを評価し、
その値が偽であった要素を集めた新しい配列を返します。
条件を反転させた select です。

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

//emlist[例][ruby]{
# 偶数を除外する (奇数を集める)
(1..6).reject {|i| i % 2 == 0 } # => [1, 3, 5]
//}

@see Enumerable#select, Array#reject
@see Enumerable#grep_v

絞り込み条件を変える

Array#reject {|item| ... } -> [object] (46.0)

各要素に対してブロックを評価し、 その値が偽であった要素を集めた新しい配列を返します。 条件を反転させた select です。

各要素に対してブロックを評価し、
その値が偽であった要素を集めた新しい配列を返します。
条件を反転させた select です。

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

//emlist[例][ruby]{
# 偶数を除外する (奇数を集める)
[1, 2, 3, 4, 5, 6].reject {|i| i % 2 == 0 } # => [1, 3, 5]
//}

@see Array#select, Enumerable#reject
@see Enumerable#grep_v

Enumerable#reject {|item| ... } -> [object] (46.0)

各要素に対してブロックを評価し、 その値が偽であった要素を集めた新しい配列を返します。 条件を反転させた select です。

各要素に対してブロックを評価し、
その値が偽であった要素を集めた新しい配列を返します。
条件を反転させた select です。

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

//emlist[例][ruby]{
# 偶数を除外する (奇数を集める)
(1..6).reject {|i| i % 2 == 0 } # => [1, 3, 5]
//}

@see Enumerable#select, Array#reject
@see Enumerable#grep_v