るりまサーチ

最速Rubyリファレンスマニュアル検索!
1009件ヒット [1-100件を表示] (0.142秒)
トップページ > クエリ:self[x] > クエリ:t[x] > ライブラリ:pathname[x]

別のキーワード

  1. object yield_self
  2. _builtin yield_self
  3. _builtin self
  4. tracepoint self
  5. codeobject document_self

クラス

キーワード

検索結果

<< 1 2 3 ... > >>

Pathname#expand_path(default_dir = &#39;.&#39;) -> Pathname (9224.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.expand_path("../") # => #<Pathname:/path/testfile>
//}

@see File.expand_path...

Pathname#realpath -> Pathname (9208.0)

余計な "."、".." や "/" を取り除いた新しい Pathname オブジェクトを返します。

...いた新しい Pathname オブジェクトを返します。

また、ファイルシステムをアクセスし、実際に存在するパスを返します。
シンボリックリンクも解決されます。

self
が指すパスが存在しない場合は例外 Errno::ENOENT が発生しま...
...emlist[例][ruby]{
require 'pathname'

Dir.rmdir("/tmp/foo") rescue nil
File.unlink("/tmp/bar/foo") rescue nil
Dir.rmdir("/tmp/bar") rescue nil

Dir.mkdir("/tmp/foo")
Dir.mkdir("/tmp/bar")
File.symlink("../foo", "/tmp/bar/foo")
path = Pathname.new("bar/././//foo/../bar")

Dir.chdir("/tmp")...
...p path.realpath

# => ruby 1.8.0 (2003-10-10) [i586-linux]
# #<Pathname:/tmp/bar>
//}

@see Pathname#realdirpath, File.realpath...

Pathname#realpath(basedir = nil) -> Pathname (9208.0)

余計な "."、".." や "/" を取り除いた新しい Pathname オブジェクトを返します。

...いた新しい Pathname オブジェクトを返します。

また、ファイルシステムをアクセスし、実際に存在するパスを返します。
シンボリックリンクも解決されます。

self
が指すパスが存在しない場合は例外 Errno::ENOENT が発生しま...
...emlist[例][ruby]{
require 'pathname'

Dir.rmdir("/tmp/foo") rescue nil
File.unlink("/tmp/bar/foo") rescue nil
Dir.rmdir("/tmp/bar") rescue nil

Dir.mkdir("/tmp/foo")
Dir.mkdir("/tmp/bar")
File.symlink("../foo", "/tmp/bar/foo")
path = Pathname.new("bar/././//foo/../bar")

Dir.chdir("/tmp")...
...p path.realpath

# => ruby 1.8.0 (2003-10-10) [i586-linux]
# #<Pathname:/tmp/bar>
//}

@see Pathname#realdirpath, File.realpath...

Pathname#relative_path_from(base_directory) -> Pathname (9136.0)

base_directory から self への相対パスを求め、その内容の新しい Pathname オブジェクトを生成して返します。

...e_directory から self への相対パスを求め、その内容の新しい Pathname
オブジェクトを生成して返します。

パス名の解決は文字列操作によって行われ、ファイルシステムをアクセス
しません。

self
が相対パスなら base_directory も...
...self が絶対パスなら
base_directory も絶対パスでなければなりません。

@param base_directory ベースディレクトリを表す Pathname オブジェクトを指定します。

@raise ArgumentError Windows上でドライブが違うなど、base_directory から self...
...の相対パスが求められないときに例外が発生します。

//emlist[例][ruby]{
require 'pathname'

path = Pathname.new("/tmp/foo")
base = Pathname.new("/tmp")

path.relative_path_from(base) # => #<Pathname:foo>
//}...

Pathname#birthtime -> Time (9118.0)

File.birthtime(self.to_s) を渡したものと同じです。

...File.birthtime(self.to_s) を渡したものと同じです。

@raise NotImplementedError Windows のような birthtime のない環境で発生します。


@see File.birthtime...

絞り込み条件を変える

Pathname#mkpath -> nil (9118.0)

FileUtils.mkpath(self.to_s) と同じです。

...FileUtils.mkpath(self.to_s) と同じです。


@see FileUtils.#mkpath...

Pathname#utime(atime, mtime) -> Integer (6318.0)

File.utime(atime, mtime, self.to_s) と同じです。

...File.utime(atime, mtime, self.to_s) と同じです。

@param atime 最終アクセス時刻を Time か、起算時からの経過秒数を数値で指定します。

@param mtime 更新時刻を Time か、起算時からの経過秒数を数値で指定します。


@see File.utime...

Pathname#atime -> Time (6218.0)

File.atime(self.to_s) を渡したものと同じです。

...File.atime(self.to_s) を渡したものと同じです。

//emlist[例][ruby]{
require "pathname"

pathname
= Pathname("testfile")
pathname
.atime # => 2018-12-18 20:58:13 +0900
//}

@see File.atime...

Pathname#binwrite(string, offset=nil) -> Integer (6218.0)

IO.binwrite(self.to_s, *args)と同じです。

...IO.binwrite(self.to_s, *args)と同じです。


@see IO.binwrite...

Pathname#ctime -> Time (6218.0)

File.ctime(self.to_s) を渡したものと同じです。

...e.ctime(self.to_s) を渡したものと同じです。

//emlist[例][ruby]{
require 'pathname'

IO.write("testfile", "test")
pathname
= Pathname("testfile")
pathname
.ctime # => 2019-01-14 00:39:51 +0900
sleep 1
pathname
.chmod(0755)
pathname
.ctime # => 2019-01-14 00:39:52 +0900
//}

@see File.ctime...

絞り込み条件を変える

<< 1 2 3 ... > >>