るりまサーチ

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

別のキーワード

  1. matrix find_index
  2. _builtin find_index
  3. pathname find
  4. _builtin find

モジュール

検索結果

<< 1 2 3 ... > >>

find (76108.0)

ディレクトリ配下のファイルを探索するためのモジュールです。

...リ配下のファイルを探索するためのモジュールです。

=== 使い方

require "find"

Find
.find('/foo','/bar') {|f| ...}

または

require "find"

include Find
find
('/foo','/bar') {|f| ...}

以下は、ruby のアーカイブに含まれるサンプルスクリプ...
...ュールで書き換えたものです。

#! /usr/bin/env ruby
require "find"
# 他人が書き込み可能な危険なコマンドを探す

for dir in ENV['PATH'].split(File::PATH_SEPARATOR)
Find
.find(dir) do |fpath|
if File.file?(fpath) and (File.stat(fpath).mode & 022) != 0...

Find.#find(*dirs) -> Enumerator (70320.0)

find(1) のように dir 配下のすべてのファイルや ディレクトリを一つずつ引数 file に渡してブロックを実行します。

...
find
(1) のように dir 配下のすべてのファイルや
ディレクトリを一つずつ引数 file に渡してブロックを実行します。

ディレクトリのシンボリックリンクは辿りません。
また file に渡される順序は不定です。

ブロックを省略...
...クトリを一つ以上指定します。


例:

require 'find'

Find
.find('/tmp') {|f|
Find
.prune if f == "/tmp/bar"
...
}

あるディレクトリ配下の探索を省略したい場合は上記のように、
Find
.#prune を使用します。この例では "/tmp/bar"
配下の...
...ファイルやディレクトリを探索しません。prune の代わりに
d:spec/control#next を使用した場合、"/tmp/bar" 自体をスキップする
だけで、その配下の探索は続行されます。

@see find(1), Find.#prune...

Find.#find(*dirs) {|file| ... } -> nil (70320.0)

find(1) のように dir 配下のすべてのファイルや ディレクトリを一つずつ引数 file に渡してブロックを実行します。

...
find
(1) のように dir 配下のすべてのファイルや
ディレクトリを一つずつ引数 file に渡してブロックを実行します。

ディレクトリのシンボリックリンクは辿りません。
また file に渡される順序は不定です。

ブロックを省略...
...クトリを一つ以上指定します。


例:

require 'find'

Find
.find('/tmp') {|f|
Find
.prune if f == "/tmp/bar"
...
}

あるディレクトリ配下の探索を省略したい場合は上記のように、
Find
.#prune を使用します。この例では "/tmp/bar"
配下の...
...ファイルやディレクトリを探索しません。prune の代わりに
d:spec/control#next を使用した場合、"/tmp/bar" 自体をスキップする
だけで、その配下の探索は続行されます。

@see find(1), Find.#prune...

Find.#find(*dirs, ignore_error: true) -> Enumerator (70320.0)

find(1) のように dir 配下のすべてのファイルや ディレクトリを一つずつ引数 file に渡してブロックを実行します。

...
find
(1) のように dir 配下のすべてのファイルや
ディレクトリを一つずつ引数 file に渡してブロックを実行します。

ディレクトリのシンボリックリンクは辿りません。
また file に渡される順序は不定です。

ブロックを省略...
...無視するかどうかを指定します。

例:

require 'find'

Find
.find('/tmp') {|f|
Find
.prune if f == "/tmp/bar"
...
}

あるディレクトリ配下の探索を省略したい場合は上記のように、
Find
.#prune を使用します。この例では "/tmp/bar"
配下...
...のファイルやディレクトリを探索しません。prune の代わりに
d:spec/control#next を使用した場合、"/tmp/bar" 自体をスキップする
だけで、その配下の探索は続行されます。

@see find(1), Find.#prune...

Find.#find(*dirs, ignore_error: true) {|file| ... } -> nil (70320.0)

find(1) のように dir 配下のすべてのファイルや ディレクトリを一つずつ引数 file に渡してブロックを実行します。

...
find
(1) のように dir 配下のすべてのファイルや
ディレクトリを一つずつ引数 file に渡してブロックを実行します。

ディレクトリのシンボリックリンクは辿りません。
また file に渡される順序は不定です。

ブロックを省略...
...無視するかどうかを指定します。

例:

require 'find'

Find
.find('/tmp') {|f|
Find
.prune if f == "/tmp/bar"
...
}

あるディレクトリ配下の探索を省略したい場合は上記のように、
Find
.#prune を使用します。この例では "/tmp/bar"
配下...
...のファイルやディレクトリを探索しません。prune の代わりに
d:spec/control#next を使用した場合、"/tmp/bar" 自体をスキップする
だけで、その配下の探索は続行されます。

@see find(1), Find.#prune...

絞り込み条件を変える

Pathname#find -> Enumerator (36264.0)

self 配下のすべてのファイルやディレクトリを 一つずつ引数 pathname に渡してブロックを実行します。

...すべてのファイルやディレクトリを
一つずつ引数 pathname に渡してブロックを実行します。

require 'find'
Find
.find(self.to_s) {|f| yield Pathname.new(f)}

と同じです。

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


@see Find.#find...

Pathname#find {|pathname| ...} -> nil (36264.0)

self 配下のすべてのファイルやディレクトリを 一つずつ引数 pathname に渡してブロックを実行します。

...すべてのファイルやディレクトリを
一つずつ引数 pathname に渡してブロックを実行します。

require 'find'
Find
.find(self.to_s) {|f| yield Pathname.new(f)}

と同じです。

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


@see Find.#find...

Pathname#find(ignore_error: true) -> Enumerator (36264.0)

self 配下のすべてのファイルやディレクトリを 一つずつ引数 pathname に渡してブロックを実行します。

...クを実行します。

require 'find'
Find
.find(self.to_s) {|f| yield Pathname.new(f)}

と同じです。

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

@param ignore_error 探索中に発生した例外を無視するかどうかを指定します。

@see Find.#find...

Pathname#find(ignore_error: true) {|pathname| ...} -> nil (36264.0)

self 配下のすべてのファイルやディレクトリを 一つずつ引数 pathname に渡してブロックを実行します。

...クを実行します。

require 'find'
Find
.find(self.to_s) {|f| yield Pathname.new(f)}

と同じです。

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

@param ignore_error 探索中に発生した例外を無視するかどうかを指定します。

@see Find.#find...

Encoding.find(name) -> Encoding (36214.0)

指定された name という名前を持つ Encoding オブジェクトを返します。

...ロケールエンコーディングを表す locale、default_external を表す external、default_internal を表す internal、ファイルシステムエンコーディングを表す filesystem があります。

//emlist[例][ruby]{
p Encoding.find("utf-8") #=> #<Encoding:UTF-8>
//}...

絞り込み条件を変える

Gem::GemPathSearcher#find(path) -> Gem::Specification | nil (36214.0)

与えられたパスにマッチする Gem::Specification を一つだけ返します。

...与えられたパスにマッチする Gem::Specification を一つだけ返します。

@see Array#find...

Find.#prune -> () (34064.0)

Find.#find メソッドのブロックにディレクトリが渡されたときにこ のメソッドを実行すると、そのディレクトリ配下の探索を無視します。

...
Find
.#find メソッドのブロックにディレクトリが渡されたときにこ
のメソッドを実行すると、そのディレクトリ配下の探索を無視します。...

Enumerable#find(ifnone = nil) -> Enumerator (30240.0)

要素に対してブロックを評価した値が真になった最初の要素を返します。

...ruby]{
# 最初の 3 の倍数を探す
p [1, 2, 3, 4, 5].find {|i| i % 3 == 0 } # => 3
p [2, 2, 2, 2, 2].find {|i| i % 3 == 0 } # => nil

# ifnone の使用例
ifnone = proc { raise ArgumentError, "item not found" }
p [1, 2, 3, 4, 5].find(ifnone) {|i| i % 7 == 0 }
# ArgumentError: item not...

Enumerable#find(ifnone = nil) {|item| ... } -> object (30240.0)

要素に対してブロックを評価した値が真になった最初の要素を返します。

...ruby]{
# 最初の 3 の倍数を探す
p [1, 2, 3, 4, 5].find {|i| i % 3 == 0 } # => 3
p [2, 2, 2, 2, 2].find {|i| i % 3 == 0 } # => nil

# ifnone の使用例
ifnone = proc { raise ArgumentError, "item not found" }
p [1, 2, 3, 4, 5].find(ifnone) {|i| i % 7 == 0 }
# ArgumentError: item not...
<< 1 2 3 ... > >>