44件ヒット
[1-44件を表示]
(0.032秒)
検索結果
先頭4件
-
Pathname
. new(path) -> Pathname (39243.0) -
文字列 path を元に Pathname オブジェクトを生成します。
...文字列 path を元に Pathname オブジェクトを生成します。
@param path 文字列、または類似のオブジェクトを与えます。
実際には to_str に反応するオブジェクトなら何でも構いません。
@raise ArgumentError path が \0 を含んで......いると発生します。
//emlist[例][ruby]{
require "pathname"
Pathname.new(__FILE__) # => #<Pathname:/path/to/file.rb>
//}... -
Pathname
. getwd -> Pathname (21169.0) -
カレントディレクトリを元に Pathname オブジェクトを生成します。 Pathname.new(Dir.getwd) と同じです。
...カレントディレクトリを元に Pathname オブジェクトを生成します。
Pathname.new(Dir.getwd) と同じです。
//emlist[例][ruby]{
require "pathname"
Pathname.getwd #=> #<Pathname:/home/zzak/projects/ruby>
//}
@see Dir.getwd... -
Pathname
. pwd -> Pathname (21169.0) -
カレントディレクトリを元に Pathname オブジェクトを生成します。 Pathname.new(Dir.getwd) と同じです。
...カレントディレクトリを元に Pathname オブジェクトを生成します。
Pathname.new(Dir.getwd) と同じです。
//emlist[例][ruby]{
require "pathname"
Pathname.getwd #=> #<Pathname:/home/zzak/projects/ruby>
//}
@see Dir.getwd... -
File
. path(filename) -> String (19.0) -
指定されたファイル名を文字列で返します。filename が文字列でない場合は、to_path メソッドを呼びます。
...//emlist[例][ruby]{
require 'pathname'
class MyPath
def initialize(path)
@path = path
end
def to_path
File.absolute_path(@path)
end
end
File.path("/dev/null") # => "/dev/null"
File.path(Pathname("/tmp")) # => "/tmp"
File.path(MyPath.new(".")) # => "/Users/user/p...