108件ヒット
[1-100件を表示]
(0.098秒)
種類
- インスタンスメソッド (66)
- 特異メソッド (30)
- 定数 (12)
キーワード
-
TO
_ PATH (12) -
absolute
_ path? (6) - join (12)
- path (39)
検索結果
先頭5件
-
Pathname
# to _ path -> String (21201.0) -
File.open などの引数に渡す際に呼ばれるメソッドです。 Pathname オブジェ クトにおいては、 to_s と同じです。
...File.open などの引数に渡す際に呼ばれるメソッドです。 Pathname オブジェ
クトにおいては、 to_s と同じです。
@see Pathname#to_s... -
Dir
# to _ path -> String (15207.0) -
オープンしているディレクトリのパス名を文字列で返します。
...オープンしているディレクトリのパス名を文字列で返します。
//emlist[例][ruby]{
Dir.open("..") do |d|
d.path # => ".."
d.to_path # => ".."
end
//}... -
File
# to _ path -> String (15201.0) -
オープン時に使用したパスを文字列で返します。
...、
File::Constants::TMPFILEオプション付きで作成されていたりする場合です。
//emlist[例][ruby]{
File.open("testfile") {|f| f.path } #=> "testfile"
File.open("/tmp/../tmp/xxx", "w") {|f| f.path } #=> "/tmp/../tmp/xxx"
File.open("/tmp", File::R......FILE File::Constants::TMPFILEオプション付きで作成されている場合に発生します。
//emlist[例][ruby]{
File.open("testfile") {|f| f.path } #=> "testfile"
File.open("/tmp/../tmp/xxx", "w") {|f| f.path } #=> "/tmp/../tmp/xxx"
File.open("/tmp", Fil......e::RDWR | File::TMPFILE){|f| f.path } # IOError: File is unnamed (TMPFILE?)
//}... -
IO
# to _ path -> String | nil (15201.0) -
IO に関連付けられたパスを返します。IO がパスに関連付けられていない場合は nil を返します。
... nil を返します。
このメソッドが返すパスがファイルシステム上に存在することは保証されていません。
//emlist[例][ruby]{
p STDIN.path # => "<STDIN>"
p IO.new(IO.sysopen("/")).path # => "/"
p IO.new(IO.sysopen("... -
Pathname
:: TO _ PATH -> Symbol (9101.0) -
内部的に使っている定数です。利用者が使うことはありません。
内部的に使っている定数です。利用者が使うことはありません。 -
File
. join(*item) -> String (6106.0) -
File::SEPARATORを間に入れて文字列を連結します。platform/DOSISH-supportで環境依存になる予定です。
...に変換されます。
配列・文字列以外のオブジェクトを指定した場合は、まず to_str メソッド、次に to_path メソッドにより暗黙の型変換を試みます。
引数がない場合には空文字列を生成して返します。
@raise......ArgumentError 引数の中に、配列要素が自身を含むような無限にネストした配列や、
ヌル文字を含む文字列が存在した場合に発生します。
//emlist[例][ruby]{
File.join("a","b") # => "a/b"
File.join("a/","......"a/b"
File.join("a/","/b") # => "a/b"
File.join("a","/b") # => "a/b"
File.join("a", ["b", ["c", ["d"]]]) # => "a/b/c/d"
File.join("", "a", ["b", ["c", ["d"]]]) # => "/a/b/c/d"
File.join([]) # => ""
File.join... -
File
. path(filename) -> String (128.0) -
指定されたファイル名を文字列で返します。filename が文字列でない場合は、to_path メソッドを呼びます。
...ます。filename が文字列でない場合は、to_path メソッドを呼びます。
@param 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/projects/txt"
//}... -
Dir
# path -> String (107.0) -
オープンしているディレクトリのパス名を文字列で返します。
...オープンしているディレクトリのパス名を文字列で返します。
//emlist[例][ruby]{
Dir.open("..") do |d|
d.path # => ".."
d.to_path # => ".."
end
//}... -
File
. absolute _ path?(file _ name) -> bool (106.0) -
file_name が絶対パスなら true を、そうでなければ false を返します。
...file_name が絶対パスなら true を、そうでなければ false を返します。
@param file_name ファイル名を表す文字列を指定します。文字列でない場合は、to_path メソッド、to_str メソッドの順で暗黙の型変換が試みられます。
@raise TypeE......=> true
File.absolute_path?("C:foo\\bar") # => false
File.absolute_path?("~") # => false
# プラットフォームが cygwin、mswin、mingw の場合
File.absolute_path?("C:\\foo\\bar") # => true
File.absolute_path?("/foo/bar\\baz") # => false
# プラットフォームが... -
File
# path -> String (101.0) -
オープン時に使用したパスを文字列で返します。
...、
File::Constants::TMPFILEオプション付きで作成されていたりする場合です。
//emlist[例][ruby]{
File.open("testfile") {|f| f.path } #=> "testfile"
File.open("/tmp/../tmp/xxx", "w") {|f| f.path } #=> "/tmp/../tmp/xxx"
File.open("/tmp", File::R......FILE File::Constants::TMPFILEオプション付きで作成されている場合に発生します。
//emlist[例][ruby]{
File.open("testfile") {|f| f.path } #=> "testfile"
File.open("/tmp/../tmp/xxx", "w") {|f| f.path } #=> "/tmp/../tmp/xxx"
File.open("/tmp", Fil......e::RDWR | File::TMPFILE){|f| f.path } # IOError: File is unnamed (TMPFILE?)
//}...