るりまサーチ

最速Rubyリファレンスマニュアル検索!
877件ヒット [1-100件を表示] (0.098秒)
トップページ > クエリ:self[x] > クエリ:t[x] > クエリ:@[x] > クエリ:path[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 (18506.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 (18431.0)

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

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

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

self
が指すパスが存在しない場合は例外 Errno::ENOENT が発生します。

@
para...
...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 (18431.0)

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

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

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

self
が指すパスが存在しない場合は例外 Errno::ENOENT が発生します。

@
para...
...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 (18366.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#mkpath -> nil (18223.0)

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

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


@
see FileUtils.#mkpath...

絞り込み条件を変える

Pathname#birthtime -> Time (12129.0)

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

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

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


@
see File.birthtime...

Pathname#utime(atime, mtime) -> Integer (9335.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#entries -> [Pathname] (9235.0)

self に含まれるファイルエントリ名を元にした Pathname オブジェクトの配列を返します。

...self に含まれるファイルエントリ名を元にした Pathname オブジェクトの配列を返します。

@
raise Errno::EXXX self が存在しないパスであったりディレクトリでなければ例外が発生します。

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

pp...
... Pathname('/usr/local').entries
# => [#<Pathname:.>,
# #<Pathname:..>,
# #<Pathname:bin>,
# #<Pathname:etc>,
# #<Pathname:include>,
# #<Pathname:lib>,
# #<Pathname:opt>,
# #<Pathname:sbin>,
# #<Pathname:share>,
# #<Pathname:var>]
//}

@
see Dir.entries...

Pathname#atime -> Time (9223.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 (9223.0)

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

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


@
see IO.binwrite...

絞り込み条件を変える

<< 1 2 3 ... > >>