277件ヒット
[1-100件を表示]
(0.019秒)
種類
- インスタンスメソッド (233)
- 特異メソッド (44)
クラス
- Pathname (277)
キーワード
- children (11)
- cleanpath (11)
- directory? (11)
- dirname (11)
-
each
_ child (22) -
each
_ entry (13) - empty? (8)
- entries (11)
- fnmatch (11)
- fnmatch? (11)
- getwd (11)
- glob (36)
- mkdir (11)
- opendir (22)
- pwd (11)
- realdirpath (11)
- realpath (22)
-
relative
_ path _ from (11) - rmdir (11)
検索結果
先頭5件
-
Pathname
# opendir -> Dir (6226.0) -
Dir.open(self.to_s, &block) と同じです。
...Dir.open(self.to_s, &block) と同じです。
@see Dir.open... -
Pathname
# opendir {|dir| . . . } -> nil (6226.0) -
Dir.open(self.to_s, &block) と同じです。
...Dir.open(self.to_s, &block) と同じです。
@see Dir.open... -
Pathname
# realdirpath(basedir = nil) -> Pathname (6202.0) -
Pathname#realpath とほぼ同じで、最後のコンポーネントは実際に 存在しなくてもエラーになりません。
...
Pathname#realpath とほぼ同じで、最後のコンポーネントは実際に
存在しなくてもエラーになりません。
@param basedir ベースディレクトリを指定します。省略するとカレントディレクトリになります。
//emlist[例][ruby]{
require "pathna......me"
path = Pathname("/not_exist")
path.realdirpath # => #<Pathname:/not_exist>
path.realpath # => Errno::ENOENT
# 最後ではないコンポーネント(/not_exist_1)も存在しないのでエラーになる。
path = Pathname("/not_exist_1/not_exist_2")
path.realdirpath # => Errno::ENOENT... -
Pathname
# mkdir(*args) -> 0 (6124.0) -
Dir.mkdir(self.to_s, *args) と同じです。
...Dir.mkdir(self.to_s, *args) と同じです。
@see Dir.mkdir... -
Pathname
# rmdir -> 0 (6124.0) -
Dir.rmdir(self.to_s) と同じです。
...Dir.rmdir(self.to_s) と同じです。
@see Dir.rmdir... -
Pathname
# directory? -> bool (6102.0) -
FileTest.directory?(self.to_s) と同じです。
...FileTest.directory?(self.to_s) と同じです。
@see FileTest.#directory?... -
Pathname
# dirname -> Pathname (6102.0) -
Pathname.new(File.dirname(self.to_s)) と同じです。
...Pathname.new(File.dirname(self.to_s)) と同じです。
//emlist[例][ruby]{
require "pathname"
Pathname('/usr/bin/shutdown').dirname # => #<Pathname:/usr/bin>
//}
@see File.dirname... -
Pathname
# realpath(basedir = nil) -> Pathname (132.0) -
余計な "."、".." や "/" を取り除いた新しい Pathname オブジェクトを返します。
...余計な "."、".." や "/" を取り除いた新しい Pathname オブジェクトを返します。
また、ファイルシステムをアクセスし、実際に存在するパスを返します。
シンボリックリンクも解決されます。
self が指すパスが存在しない場......edir ベースディレクトリを指定します。省略するとカレントディレクトリになります。
//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
# expand _ path(default _ dir = & # 39; . & # 39;) -> Pathname (115.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
# children(with _ directory = true) -> [Pathname] (102.0) -
self 配下にあるパス名(Pathnameオブジェクト)の配列を返します。
...self 配下にあるパス名(Pathnameオブジェクト)の配列を返します。
ただし、 ".", ".." は要素に含まれません。
@param with_directory 偽を指定するとファイル名のみ返します。デフォルトは真です。
@raise Errno::EXXX self が存在しないパ......スであったりディレクトリでなければ例外が発生します。
//emlist[例][ruby]{
require 'pathname'
Pathname.new("/tmp").children # => [#<Pathname:.X11-unix>, #<Pathname:.iroha_unix>, ... ]
//}...