3件ヒット
[1-3件を表示]
(0.028秒)
種類
- モジュール関数 (1)
- 特異メソッド (1)
- インスタンスメソッド (1)
モジュール
- Kernel (1)
検索結果
先頭3件
-
Pathname
# expand _ path(default _ dir = & # 39; . & # 39;) -> Pathname (54424.0) -
Pathname.new(File.expand_path(self.to_s, *args)) と同じです。
Pathname.new(File.expand_path(self.to_s, *args)) と同じです。
@param default_dir self が相対パスであれば default_dir を基準に展開されます。
//emlist[例][ruby]{
require "pathname"
path = Pathname("testfile")
Pathname.pwd # => #<Pathname:/path/to>
path.expand_path # => #<Pathname:/path/to/testfile>
path.e... -
File
. expand _ path(path , default _ dir = & # 39; . & # 39;) -> String (54412.0) -
path を絶対パスに展開した文字列を返します。 path が相対パスであれば default_dir を基準にします。
path を絶対パスに展開した文字列を返します。
path が相対パスであれば default_dir を基準にします。
先頭の ~ はホームディレクトリ(環境変数 HOME が使われます)に、
~USER はそのユーザのホームディレクトリに展開されます。
//emlist[例][ruby]{
p Dir.getwd #=> "/home/matz/work/foo"
p ENV["HOME"] #=> "/home/matz"
p File.expand_path("..") #=> "/h... -
Kernel
. # require _ relative(relative _ feature) -> bool (37.0) -
現在のファイルからの相対パスで require します。
現在のファイルからの相対パスで require します。
require File.expand_path(relative_feature, File.dirname(__FILE__))
とほぼ同じです。
Kernel.#eval などで文字列を評価した場合に、そこから
require_relative を呼出すと必ず失敗します。
@param relative_feature ファイル名の文字列です。
@raise LoadError ロードに失敗した場合に発生します。
@see Kernel.#require
=== require と load のスコープ
ローカル変数...