種類
- インスタンスメソッド (1144)
- 特異メソッド (55)
- 定数 (22)
クラス
- Pathname (1210)
モジュール
- Kernel (11)
キーワード
- + (11)
-
/ (10) - <=> (11)
- == (11)
- === (11)
- Pathname (11)
-
SEPARATOR
_ PAT (11) -
TO
_ PATH (11) - absolute? (11)
- ascend (22)
- atime (11)
- basename (11)
- binread (11)
- binwrite (11)
- birthtime (10)
- blockdev? (11)
- chardev? (11)
- children (11)
- chmod (11)
- chown (11)
- cleanpath (11)
- ctime (11)
- delete (11)
- descend (22)
- directory? (11)
- dirname (11)
-
each
_ child (22) -
each
_ entry (13) -
each
_ filename (11) -
each
_ line (22) - empty? (8)
- entries (11)
- eql? (11)
- executable? (11)
-
executable
_ real? (11) - exist? (11)
- extname (11)
- file? (11)
- find (22)
- fnmatch (11)
- fnmatch? (11)
- ftype (11)
- getwd (11)
- glob (36)
- grpowned? (11)
- hash (11)
- join (11)
- lchmod (11)
- lchown (11)
- lstat (11)
-
make
_ link (11) -
make
_ symlink (11) - mkdir (11)
- mkpath (11)
- mountpoint? (11)
- mtime (11)
- new (11)
- open (22)
- opendir (22)
- owned? (11)
- parent (11)
- pipe? (11)
- pwd (11)
- read (11)
- readable? (11)
-
readable
_ real? (11) - readlines (11)
- readlink (11)
- realdirpath (11)
- realpath (22)
- relative? (11)
-
relative
_ path _ from (11) - rename (11)
- rmdir (11)
- rmtree (11)
- root? (11)
- setgid? (11)
- setuid? (11)
- size (11)
- size? (11)
- socket? (11)
- split (11)
- stat (11)
- sticky? (11)
- sub (22)
-
sub
_ ext (11) - symlink? (11)
- sysopen (11)
-
to
_ path (11) -
to
_ s (11) - truncate (11)
- unlink (11)
- utime (11)
-
world
_ readable? (11) -
world
_ writable? (11) - writable? (11)
-
writable
_ real? (11) - write (11)
- zero? (11)
検索結果
先頭5件
-
Pathname
# ctime -> Time (126.0) -
File.ctime(self.to_s) を渡したものと同じです。
....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... -
Pathname
# glob(pattern , flags=0) -> [Pathname] (120.0) -
ワイルドカードの展開を行なった結果を、 Pathname オブジェクトの配列として返します。
...、
Pathname オブジェクトの配列として返します。
引数の意味は、Dir.glob と同じです。 flag の初期値である 0 は「何
も指定しない」ことを意味します。
ブロックが与えられたときは、ワイルドカードにマッチした Pathname オ......ンです
@param flags パターンマッチ時のふるまいを変化させるフラグを指定します
//emlist[][ruby]{
require "pathname"
Pathname("ruby-2.4.2").glob("R*.md") # => [#<Pathname:ruby-2.4.2/README.md>, #<Pathname:ruby-2.4.2/README.ja.md>]
//}
@see Dir.glob
@see Pathname.glob... -
Pathname
# glob(pattern , flags=0) {|pathname| . . . } -> nil (120.0) -
ワイルドカードの展開を行なった結果を、 Pathname オブジェクトの配列として返します。
...、
Pathname オブジェクトの配列として返します。
引数の意味は、Dir.glob と同じです。 flag の初期値である 0 は「何
も指定しない」ことを意味します。
ブロックが与えられたときは、ワイルドカードにマッチした Pathname オ......ンです
@param flags パターンマッチ時のふるまいを変化させるフラグを指定します
//emlist[][ruby]{
require "pathname"
Pathname("ruby-2.4.2").glob("R*.md") # => [#<Pathname:ruby-2.4.2/README.md>, #<Pathname:ruby-2.4.2/README.ja.md>]
//}
@see Dir.glob
@see Pathname.glob... -
Pathname
# realpath -> Pathname (120.0) -
余計な "."、".." や "/" を取り除いた新しい Pathname オブジェクトを返します。
...余計な "."、".." や "/" を取り除いた新しい Pathname オブジェクトを返します。
また、ファイルシステムをアクセスし、実際に存在するパスを返します。
シンボリックリンクも解決されます。
self が指すパスが存在しない場......す。
//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.chd......ir("/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 (120.0) -
余計な "."、".." や "/" を取り除いた新しい Pathname オブジェクトを返します。
...余計な "."、".." や "/" を取り除いた新しい Pathname オブジェクトを返します。
また、ファイルシステムをアクセスし、実際に存在するパスを返します。
シンボリックリンクも解決されます。
self が指すパスが存在しない場......す。
//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.chd......ir("/tmp")
p path.realpath
# => ruby 1.8.0 (2003-10-10) [i586-linux]
# #<Pathname:/tmp/bar>
//}
@see Pathname#realdirpath, File.realpath... -
Pathname
# atime -> Time (114.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
# <=>(other) -> -1 | 0 | 1 | nil (109.0) -
パス名を比較します。other と同じなら 0 を、ASCII順で self が大きい場合 は正、other が大きい場合は負を返します。大文字小文字は区別されます。 other は Pathname オブジェクトでなければなりません。
...other は Pathname オブジェクトでなければなりません。
パス名の比較は単純にパス文字列の比較によって行われるので、論理的に
同じパスでもパス文字列が違えば異なると判断されます。
@param other 比較対象の Pathname オブジ......ェクトを指定します。
//emlist[例][ruby]{
require 'pathname'
p Pathname.new("foo/bar") <=> Pathname.new("foo/bar")
p Pathname.new("foo/bar") <=> Pathname.new("foo//bar")
p Pathname.new("foo/../foo/bar") <=> Pathname.new("foo/bar")
# => 0
# 1
# -1
//}... -
Pathname
# children(with _ directory = true) -> [Pathname] (108.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>, ... ]
//}... -
Kernel
# Pathname(path) -> Pathname (102.0) -
文字列 path を元に Pathname オブジェクトを生成します。
...文字列 path を元に Pathname オブジェクトを生成します。
Pathname.new(path) と同じです。
@param path 文字列、または類似のオブジェクトを与えます。
実際には to_str に反応するオブジェクトなら何でも構いません。... -
Pathname
# +(other) -> Pathname (102.0) -
パス名を連結します。つまり、other を self からの相対パスとした新しい Pathname オブジェクトを生成して返します。
...た新しい
Pathname オブジェクトを生成して返します。
other が絶対パスなら単に other と同じ内容の Pathname オブジェクトが返さ
れます。
//emlist[例][ruby]{
require 'pathname'
Pathname("foo/bar")+"baz" # => #<Pathname:foo/bar/baz>
Pathname("foo/bar/")+"......baz" # => #<Pathname:foo/bar/baz>
Pathname("foo/bar")+"/baz" # => #<Pathname:/baz>
Pathname("foo/bar")+"../baz" # => #<Pathname:foo/baz>
//}
@param other 文字列か Pathname オブジェクトを指定します。...