るりまサーチ (Ruby 2.4.0)

最速Rubyリファレンスマニュアル検索!
3件ヒット [1-3件を表示] (0.022秒)
トップページ > バージョン:2.4.0[x] > クエリ:Dir[x] > クエリ:children[x]

別のキーワード

  1. dir chdir
  2. dir open
  3. dir foreach
  4. dir each_child
  5. rake original_dir

ライブラリ

クラス

検索結果

Pathname#children(with_directory = true) -> [Pathname] (54622.0)

self 配下にあるパス名(Pathnameオブジェクト)の配列を返します。

self 配下にあるパス名(Pathnameオブジェクト)の配列を返します。

ただし、 ".", ".." は要素に含まれません。

@param with_directory 偽を指定するとファイル名のみ返します。デフォルトは真です。

@raise Errno::EXXX self が存在しないパスであったりディレクトリでなければ例外が発生します。

//emlist[例][ruby]{
require 'pathname'
Pathname.new("/tmp").children # => [#<Pathname:.X11-unix>, #<Pathname:.iroha_unix>...

Pathname#each_child(with_directory = true) -> Enumerator (367.0)

self.children(with_directory).each と同じです。

self.children(with_directory).each と同じです。

@param with_directory 偽を指定するとファイル名のみ返します。デフォルトは真です。

//emlist[例][ruby]{
require "pathname"

Pathname("/usr/local").each_child {|f| p f }
# => #<Pathname:/usr/local/bin>
# => #<Pathname:/usr/local/etc>
# => #<Pathname:/usr/local/include>
# => #<Pathname:/us...

Pathname#each_child(with_directory = true) {|pathname| ...} -> [Pathname] (367.0)

self.children(with_directory).each と同じです。

self.children(with_directory).each と同じです。

@param with_directory 偽を指定するとファイル名のみ返します。デフォルトは真です。

//emlist[例][ruby]{
require "pathname"

Pathname("/usr/local").each_child {|f| p f }
# => #<Pathname:/usr/local/bin>
# => #<Pathname:/usr/local/etc>
# => #<Pathname:/usr/local/include>
# => #<Pathname:/us...