るりまサーチ

最速Rubyリファレンスマニュアル検索!
443件ヒット [1-100件を表示] (0.104秒)

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. dsa p
  5. kernel p

ライブラリ

キーワード

検索結果

<< 1 2 3 ... > >>

Pathname#expand_path(default_dir = &#39;.&#39;) -> Pathname (15324.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"

p
ath = Pathname("testfile")
Pathname
.pwd # => #<Pathname:/path/to>
p
ath.expand_...
...path # => #<Pathname:/path/to/testfile>
p
ath.expand_path("../") # => #<Pathname:/path/testfile>
//}

@see File.expand_path...

Pathname#realpath -> Pathname (9226.0)

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

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

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

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

@para...
...quire '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")
p
ath = 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 (9226.0)

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

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

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

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

@para...
...quire '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")
p
ath = 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#cleanpath(consider_symlink = false) -> Pathname (9214.0)

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

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

cleanpath は、実際にファイルシステムを参照することなく、文字列操作
だけで処理を行います。

@param consider_symlink 真ならパス要素にシンボリック...
...quire "pathname"
p
ath = Pathname.new("//.././../")
p
ath # => #<Pathname://.././../>
p
ath.cleanpath # => #<Pathname:/>


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")
p
ath = Pathname.new("bar/././//foo/../bar")
Dir.chdir("/tmp")

p
ath.cleanpath # => #<Pathname:bar/bar>
p
ath.cleanpath(true) # => #<Pathname:bar/foo/../bar>
//}...

Pathname#file? -> bool (9125.0)

FileTest.file?(self.to_s) と同じです。

...FileTest.file?(self.to_s) と同じです。


@see FileTest.#file?...

絞り込み条件を変える

Pathname#to_path -> String (9118.0)

File.open などの引数に渡す際に呼ばれるメソッドです。 Pathname オブジェ クトにおいては、 to_s と同じです。

...File.open などの引数に渡す際に呼ばれるメソッドです。 Pathname オブジェ
クトにおいては、 to_s と同じです。


@see Pathname#to_s...

Pathname#each_filename {|v| ... } -> nil (9108.0)

self のパス名要素毎にブロックを実行します。

...self のパス名要素毎にブロックを実行します。

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

Pathname
.new("/foo/../bar").each_filename {|v| p v}

# => "foo"
# ".."
# "bar"
//}...

Pathname#open(mode = &#39;r&#39;, perm = 0666) -> File (6326.0)

File.open(self.to_s, *args, &block) と同じです。

...File.open(self.to_s, *args, &block) と同じです。


@see File.open...

Pathname#open(mode = &#39;r&#39;, perm = 0666) {|file| ... } -> object (6326.0)

File.open(self.to_s, *args, &block) と同じです。

...File.open(self.to_s, *args, &block) と同じです。


@see File.open...
<< 1 2 3 ... > >>