るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 > >>

Enumerator::Lazy#grep(pattern) {|item| ... } -> Enumerator::Lazy (24453.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/).take(10).force
# => ["111", "222", "333", "444", "555", "666", "777", "888", "999", "1111"]
//}

@see Enumerable#grep...
...).lazy.map(&:to_s).grep(/\A(\d)\1+\z/).take(10).force
# => ["111", "222", "333", "444", "555", "666", "777", "888", "999", "1111"]
//}

@see Enumerable#grep, Enumerable#grep_v, Enumerator::Lazy#grep_v...

Enumerable#grep(pattern) {|item| ... } -> [object] (24226.0)

pattern === item が成立する要素を全て含んだ配列を返します。

...pattern === item が成立する要素を全て含んだ配列を返します。

ブロックとともに呼び出された時には条件の成立した要素に対して
それぞれブロックを評価し、その結果の配列を返します。
マッチする要素がひとつもなかっ...
...返します。

@param pattern 「===」メソッドを持つオブジェクトを指定します。

//emlist[例][ruby]{
['aa', 'bb', 'cc', 'dd', 'ee'].grep(/[bc]/) # => ["bb", "cc"]

Array.instance_methods.grep(/gr/) # => [:grep, :group_by]
//}

@see Enumerable#select
@see Enumerable#grep_v...

Enumerable#filter -> Enumerator (15318.0)

各要素に対してブロックを評価した値が真であった要素を全て含む配列を 返します。真になる要素がひとつもなかった場合は空の配列を返します。

...Enumerator を返します。

//emlist[例][ruby]{
(1..10).find_all # => #<Enumerator: 1..10:find_all>
(1..10).find_all { |i| i % 3 == 0 } # => [3, 6, 9]

[1,2,3,4,5].select # => #<Enumerator: [1, 2, 3, 4, 5]:select>
[1,2,3,4,5].select { |num| num.ev...
...en? } # => [2, 4]
//}

@see Enumerable#reject
@see Enumerable#grep...

Enumerable#find_all -> Enumerator (15318.0)

各要素に対してブロックを評価した値が真であった要素を全て含む配列を 返します。真になる要素がひとつもなかった場合は空の配列を返します。

...Enumerator を返します。

//emlist[例][ruby]{
(1..10).find_all # => #<Enumerator: 1..10:find_all>
(1..10).find_all { |i| i % 3 == 0 } # => [3, 6, 9]

[1,2,3,4,5].select # => #<Enumerator: [1, 2, 3, 4, 5]:select>
[1,2,3,4,5].select { |num| num.ev...
...en? } # => [2, 4]
//}

@see Enumerable#reject
@see Enumerable#grep...

Kernel.#require(feature) -> bool (15312.0)

Ruby ライブラリ feature をロードします。拡張子補完を行い、 同じファイルの複数回ロードはしません。

...Ruby ライブラリ feature をロードします。拡張子補完を行い、
同じファイルの複数回ロードはしません。

feature が絶対パスのときは feature からロードします。
feature が相対パスのときは組み込み変数 $:
に示されるパスを順番...
...数 HOME の値に展開されます。
また `~USER' はそのユーザのホームディレクトリに展開されます。

Ruby ライブラリとは Ruby スクリプト (*.rb) か拡張ライブラリ
(*.so,*.o,*.dll など) であり、feature の拡張子が省略された場合はその...
...は true を返し、ロードした feature の名前を(拡
張子も含めて) 変数 $" に追加します。ただし、feature の名前が既に $"
に含まれていた場合はロードせずに false を返します。

@param feature ファイル名の文字列です。
@raise LoadError...

絞り込み条件を変える

Enumerable#filter {|item| ... } -> [object] (15218.0)

各要素に対してブロックを評価した値が真であった要素を全て含む配列を 返します。真になる要素がひとつもなかった場合は空の配列を返します。

...Enumerator を返します。

//emlist[例][ruby]{
(1..10).find_all # => #<Enumerator: 1..10:find_all>
(1..10).find_all { |i| i % 3 == 0 } # => [3, 6, 9]

[1,2,3,4,5].select # => #<Enumerator: [1, 2, 3, 4, 5]:select>
[1,2,3,4,5].select { |num| num.ev...
...en? } # => [2, 4]
//}

@see Enumerable#reject
@see Enumerable#grep...

Enumerable#find_all {|item| ... } -> [object] (15218.0)

各要素に対してブロックを評価した値が真であった要素を全て含む配列を 返します。真になる要素がひとつもなかった場合は空の配列を返します。

...Enumerator を返します。

//emlist[例][ruby]{
(1..10).find_all # => #<Enumerator: 1..10:find_all>
(1..10).find_all { |i| i % 3 == 0 } # => [3, 6, 9]

[1,2,3,4,5].select # => #<Enumerator: [1, 2, 3, 4, 5]:select>
[1,2,3,4,5].select { |num| num.ev...
...en? } # => [2, 4]
//}

@see Enumerable#reject
@see Enumerable#grep...

Enumerator::Lazy#grep_v(pattern) {|item| ... } -> Enumerator::Lazy (12453.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/).take(15).force
# => ["102", "103", "104", "105", "106", "107", "108", "109", "120", "123", "124", "125", "126", "127", "128"]
//}

@see Enumerable#grep_v, Enumerable#grep, Enumerator::Lazy#grep...

Rake::FileList#egrep(pattern) {|filename, count, line| ... } (12416.0)

与えられたパターンをファイルリストから grep のように検索します。

...与えられたパターンをファイルリストから grep のように検索します。

ブロックが与えられた場合は、マッチした行の情報 (ファイル名、行番号、マッチした行) が
ブロックに渡されてブロックが評価されます。ブロックが...
...//emlist[][ruby]{
# Rakefile での記載例とする

I
O.write("sample1", "line1\nline2\nline3\n")
I
O.write("sample2", "line1\nline2\nline3\nline4\n")

task default: :test_rake_app
task :test_rake_app do

file_list = FileList.new('sample*')
file_list.egrep(/line/) # => 7

file_list.egrep(/.*...
...ilename, count, line|
"filename = #{filename}, count = #{count}, line = #{line}"
end
end

# => "filename = sample1, count = 1, line = line1\n"
# => "filename = sample1, count = 2, line = line2\n"
# => "filename = sample1, count = 3, line = line3\n"
# => "filename = sample2, count = 1, line = l...

Open3.#pipeline(*cmds) -> [Process::Status] (12306.0)

指定したコマンドのリストをパイプで繋いで順番に実行します。

...それぞれのコマンドは
以下のように String か Array で指定します。
commandline にはコマンド全体(例. "nroff -man")を表す
String を指定します。
options には Hash で指定します。
env には環...
...名を表す String を指定します。
1、2、3 は shell 経由で実行されます。

(1) commandline
(2) [commandline, options]
(3) [env, commandline, options]
(4) [env, cmdname, arg1, arg2, ..., options]
(5) [env, [cmdname, argv0], arg1, ..., options]

@return 実行した...
..."/usr/share/man/man1/ruby.1.gz"
p Open3.pipeline(["zcat", fname], "nroff -man", "less")
#=> [#<Process::Status: pid 11817 exit 0>,
# #<Process::Status: pid 11820 exit 0>,
# #<Process::Status: pid 11828 exit 0>]

例2:

require "open3"

Open3.pipeline([{"LANG"=>"C"}, "env"], ["grep"...

絞り込み条件を変える

Enumerable#grep_v(pattern) { |item| ... } -> [object] (12236.0)

Enumerable#grep のマッチの条件を逆にして、pattern === item が成立 しない要素を全て含んだ配列を返します。

...Enumerable#grep のマッチの条件を逆にして、pattern === item が成立
しない要素を全て含んだ配列を返します。

@param pattern 「===」メソッドを持つオブジェクトを指定します。

//emlist[例][ruby]{
(1..10).grep_v 2..5 # => [1, 6, 7, 8, 9, 10]
res...
...=(1..10).grep_v(2..5) { |v| v * 2 }
res # => [2, 12, 14, 16, 18, 20]
//}

@see Enumerable#grep
@see Enumerable#reject...
<< 1 2 > >>