るりまサーチ

最速Rubyリファレンスマニュアル検索!
472件ヒット [1-100件を表示] (0.366秒)
トップページ > クエリ:_builtin[x] > ライブラリ:ビルトイン[x] > クエリ:E[x] > クラス:Dir[x]

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

キーワード

検索結果

<< 1 2 3 ... > >>

Dir.children(path, encoding: enc) -> [String] (14303.0)

ディレクトリ path に含まれるファイルエントリ名のうち、 "." と ".." をのぞいた配列を返します。

...す。

@param encoding ディレクトリのエンコーディングを文字列か
E
ncoding オブジェクトで指定します。省略した場合は
ファイルシステムのエンコーディングと同じになります。

@raise Errno::EXXX 失敗した...
...場合に発生します。

//emlist[例][ruby]{
Dir
.children('.') #=> ["bar", "foo"]
//}

@see Dir.each_child
@see Dir.entries...
...場合に発生します。

//emlist[例][ruby]{
Dir
.children('.') #=> ["bar", "foo"]
//}

@see Dir#children
@see Dir.each_child
@see Dir.entries...

Dir.entries(path, encoding: Encoding.find("filesystem")) -> [String] (14303.0)

ディレクトリ path に含まれるファイルエントリ名の 配列を返します。

...す。

@param encoding ディレクトリのエンコーディングを文字列か
E
ncoding オブジェクトで指定します。省略した場合は
ファイルシステムのエンコーディングと同じになります。

@raise Errno::EXXX 失敗した...
...場合に発生します。

//emlist[例][ruby]{
Dir
.entries('.') #=> [".", "..", "bar", "foo"]
//}

@see Dir.foreach...
...場合に発生します。

//emlist[例][ruby]{
Dir
.entries('.') #=> [".", "..", "bar", "foo"]
//}

@see Dir.foreach
@see Dir.children...

Dir.open(path, encoding: Encoding.find("filesystem")) -> Dir (14303.0)

path に対するディレクトリストリームをオープンして返します。

...す。

@param encoding ディレクトリのエンコーディングを文字列か
E
ncoding オブジェクトで指定します。省略した場合は
ファイルシステムのエンコーディングと同じになります。

@raise Errno::EXXX オープン...
...

//emlist[例: Dir.new][ruby]{
require 'tmpdir'

Dir
.mktmpdir do |tmpdir|
d = Dir.new(tmpdir)
p d.class # => Dir
p d.read.encoding # => #<Encoding:UTF-8>
d.close

d = Dir.new(tmpdir, encoding: Encoding::UTF_8)
p d.class # => Dir
p d.read.encoding # => #<Encoding:UTF...
...-8>
d.close
e
nd
//}

//emlist[例: Dir.open][ruby]{
require 'tmpdir'

Dir
.mktmpdir do |tmpdir|
d = Dir.open(tmpdir, encoding: Encoding::UTF_8)
p d.class # => Dir
p d.read.encoding # => #<Encoding:UTF-8>
d.close

Dir
.open(tmpdir, encoding: Encoding::UTF_8) do |d|
p d.class...

Dir.open(path, encoding: Encoding.find("filesystem")) {|dir| ...} -> object (14303.0)

path に対するディレクトリストリームをオープンして返します。

...す。

@param encoding ディレクトリのエンコーディングを文字列か
E
ncoding オブジェクトで指定します。省略した場合は
ファイルシステムのエンコーディングと同じになります。

@raise Errno::EXXX オープン...
...

//emlist[例: Dir.new][ruby]{
require 'tmpdir'

Dir
.mktmpdir do |tmpdir|
d = Dir.new(tmpdir)
p d.class # => Dir
p d.read.encoding # => #<Encoding:UTF-8>
d.close

d = Dir.new(tmpdir, encoding: Encoding::UTF_8)
p d.class # => Dir
p d.read.encoding # => #<Encoding:UTF...
...-8>
d.close
e
nd
//}

//emlist[例: Dir.open][ruby]{
require 'tmpdir'

Dir
.mktmpdir do |tmpdir|
d = Dir.open(tmpdir, encoding: Encoding::UTF_8)
p d.class # => Dir
p d.read.encoding # => #<Encoding:UTF-8>
d.close

Dir
.open(tmpdir, encoding: Encoding::UTF_8) do |d|
p d.class...

Dir#children -> [String] (14103.0)

ディレクトリのファイルエントリ名のうち、 "." と ".." をのぞいた配列を返します。

...ディレクトリのファイルエントリ名のうち、
"." と ".." をのぞいた配列を返します。

@raise IOError 既に self が close している場合に発生します。

//emlist[例][ruby]{
Dir
.open('.'){|d|
p d.children # => ["bar", "foo"]
}
//}

@see Dir.children...

絞り込み条件を変える

Dir#close -> nil (14103.0)

ディレクトリストリームをクローズします。 クローズに成功すれば nil を返します。

...に対する操作は例外 IOError を発生させます。
クローズに成功すれば nil を返します。

//emlist[例][ruby]{
d = Dir.new(".")
d.close # => nil
//}

@raise IOError close に失敗した場合に発生します。また既に自身が close している場合に発生し...
...ディレクトリストリームをクローズします。
クローズに成功すれば nil を返します。

//emlist[例][ruby]{
d = Dir.new(".")
d.close # => nil
//}...

Dir#each -> Enumerator (14103.0)

ディレクトリの各エントリを表す文字列を引数として、ブロックを評価します。

...えられなかった場合、各エントリを文字列として保持する
E
numerator
オブジェクトを返します。

@raise IOError 既に自身が close している場合に発生します。

//emlist[例][ruby]{
Dir
.open('.').each{|f|
p f
}
#=> "."
# ".."
# "bar"
# "foo"
//}...
...場合、各エントリを文字列として保持する
E
numerator
オブジェクトを返します。

@raise IOError 既に自身が close している場合に発生します。

//emlist[例][ruby]{
Dir
.open('.').each{|f|
p f
}
#=> "."
# ".."
# "bar"
# "foo"
//}

@see Dir#each_child...

Dir#each {|item| ... } -> self (14103.0)

ディレクトリの各エントリを表す文字列を引数として、ブロックを評価します。

...えられなかった場合、各エントリを文字列として保持する
E
numerator
オブジェクトを返します。

@raise IOError 既に自身が close している場合に発生します。

//emlist[例][ruby]{
Dir
.open('.').each{|f|
p f
}
#=> "."
# ".."
# "bar"
# "foo"
//}...
...場合、各エントリを文字列として保持する
E
numerator
オブジェクトを返します。

@raise IOError 既に自身が close している場合に発生します。

//emlist[例][ruby]{
Dir
.open('.').each{|f|
p f
}
#=> "."
# ".."
# "bar"
# "foo"
//}

@see Dir#each_child...

Dir#each_child -> Enumerator (14103.0)

ディレクトリの "." と ".." をのぞく各エントリを表す文字列を引数として、 ブロックを評価します。

...合、各エントリを文字列として保持する
E
numerator
オブジェクトを返します。

@raise IOError 既に self が close している場合に発生します。

//emlist[例][ruby]{
Dir
.open('.').each_child{|f|
p f
}
#=> "bar"
# "foo"
//}

@see Dir#each
@see Dir.each_child...

Dir#each_child {|item| ... } -> self (14103.0)

ディレクトリの "." と ".." をのぞく各エントリを表す文字列を引数として、 ブロックを評価します。

...合、各エントリを文字列として保持する
E
numerator
オブジェクトを返します。

@raise IOError 既に self が close している場合に発生します。

//emlist[例][ruby]{
Dir
.open('.').each_child{|f|
p f
}
#=> "bar"
# "foo"
//}

@see Dir#each
@see Dir.each_child...

絞り込み条件を変える

Dir#fileno -> Integer (14103.0)

self に関連づけられたファイル記述子を表す整数を返します。

...self に関連づけられたファイル記述子を表す整数を返します。

//emlist[例][ruby]{
Dir
.open("..") { |d| d.fileno } # => 8
//}

本メソッドでは POSIX 2008 で定義されている dirfd() 関数を使用します。

@raise NotImplementedError Windows などの dirfd()...
...関数が存在しないプラッ
トフォームで発生します。
@raise IOError 既に自身が close している場合に発生します。

@see IO#fileno...
<< 1 2 3 ... > >>