るりまサーチ (Ruby 2.4.0)

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

別のキーワード

  1. _builtin nil?
  2. object nil?
  3. nilclass nil?
  4. object nil
  5. _builtin nil

クラス

キーワード

検索結果

Dir.home -> String | nil (54709.0)

現在のユーザまたは指定されたユーザのホームディレクトリを返します。

現在のユーザまたは指定されたユーザのホームディレクトリを返します。

Dir.home や Dir.home("root") は
File.expand_path("~") や File.expand_path("~root") と
ほぼ同じです。

//emlist[例][ruby]{
Dir.home # => "/home/vagrant"
Dir.home("root") # => "/root"
//}

@see File.expand_path

Dir.home(user) -> String | nil (54709.0)

現在のユーザまたは指定されたユーザのホームディレクトリを返します。

現在のユーザまたは指定されたユーザのホームディレクトリを返します。

Dir.home や Dir.home("root") は
File.expand_path("~") や File.expand_path("~root") と
ほぼ同じです。

//emlist[例][ruby]{
Dir.home # => "/home/vagrant"
Dir.home("root") # => "/root"
//}

@see File.expand_path

File.absolute_path(file_name, dir_string=nil) -> String (418.0)

file_name を絶対パスに変換した文字列を返します。

file_name を絶対パスに変換した文字列を返します。

相対パスの場合はカレントディレクトリを基準とします。
dir_string を渡した場合はそのディレクトリを基準とします。

File.expand_path と異なり、 file_name 先頭が "~" である場合
それは展開されません。普通のディレクトリ名として処理されます。

//emlist[例][ruby]{
p Dir.getwd #=> "/home/matz/work/bar"
p ENV["HOME"] #=> "/home/mat...

File.realpath(pathname, basedir = nil) -> String (382.0)

与えられた pathname に対応する絶対パスを返します。

与えられた pathname に対応する絶対パスを返します。

pathname の全てのコンポーネントは存在しなければなりません。

@param pathname ファイル名を指定します。

@param basedir ベースディレクトリを指定します。省略するとカレントディレクトリを使用します。

@raise Errno::ENOENT ファイルが存在しない場合に発生します。

//emlist[例][ruby]{
ENV["HOME"] # => "/home/matz"
File.symlink("testfile", "testlink"...