るりまサーチ (Ruby 2.7.0)

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

別のキーワード

  1. string []=
  2. string []
  3. string slice
  4. string slice!
  5. string gsub

ライブラリ

キーワード

検索結果

Dir#path -> String (313.0)

オープンしているディレクトリのパス名を文字列で返します。

...オープンしているディレクトリのパス名を文字列で返します。

//emlist[例][ruby]{
Dir
.open("..") do |d|
d.path # => ".."
d.to_path # => ".."
end
//}...

Dir#to_path -> String (313.0)

オープンしているディレクトリのパス名を文字列で返します。

...オープンしているディレクトリのパス名を文字列で返します。

//emlist[例][ruby]{
Dir
.open("..") do |d|
d.path # => ".."
d.to_path # => ".."
end
//}...

Dir#children -> [String] (310.0)

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

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

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

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

@see Dir.children...

Dir#inspect -> String (310.0)

self の情報を人間に読みやすい文字列にして返します。

...self の情報を人間に読みやすい文字列にして返します。

//emlist[例][ruby]{
Dir
.open("/") { |d| d.inspect } # => "#<Dir:/>"
//}...

Dir#read -> String | nil (310.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 # => ".."...

絞り込み条件を変える