50件ヒット
[1-50件を表示]
(0.116秒)
検索結果
先頭5件
-
Dir
# path -> String (104.0) -
オープンしているディレクトリのパス名を文字列で返します。
...オープンしているディレクトリのパス名を文字列で返します。
//emlist[例][ruby]{
Dir.open("..") do |d|
d.path # => ".."
d.to_path # => ".."
end
//}... -
Dir
# to _ path -> String (104.0) -
オープンしているディレクトリのパス名を文字列で返します。
...オープンしているディレクトリのパス名を文字列で返します。
//emlist[例][ruby]{
Dir.open("..") do |d|
d.path # => ".."
d.to_path # => ".."
end
//}... -
Dir
# children -> [String] (103.0) -
ディレクトリのファイルエントリ名のうち、 "." と ".." をのぞいた配列を返します。
...ディレクトリのファイルエントリ名のうち、
"." と ".." をのぞいた配列を返します。
@raise IOError 既に self が close している場合に発生します。
//emlist[例][ruby]{
Dir.open('.'){|d|
p d.children # => ["bar", "foo"]
}
//}
@see Dir.children... -
Dir
# inspect -> String (103.0) -
self の情報を人間に読みやすい文字列にして返します。
...self の情報を人間に読みやすい文字列にして返します。
//emlist[例][ruby]{
Dir.open("/") { |d| d.inspect } # => "#<Dir:/>"
//}... -
Dir
# read -> String | nil (103.0) -
ディレクトリストリームから次の要素を読み出して返します。最後の要素 まで読み出していれば nil を返します。
...場合に発生します。
//emlist[例][ruby]{
require 'tmpdir'
Dir.mktmpdir do |tmpdir|
File.open("#{tmpdir}/test1.txt", "w") { |f| f.puts("test1") }
File.open("#{tmpdir}/test2.txt", "w") { |f| f.puts("test2") }
Dir.open(tmpdir) do |d|
p d.read # => "."
p d.read # => ".."...