キーワード
- + (1)
-
/ (1) - <=> (1)
- == (1)
- === (1)
- absolute? (1)
- ascend (2)
- atime (1)
- basename (1)
- binread (1)
- binwrite (1)
- birthtime (1)
- blockdev? (1)
- chardev? (1)
- children (1)
- chmod (1)
- chown (1)
- cleanpath (1)
- ctime (1)
- delete (1)
- descend (2)
- directory? (1)
- dirname (1)
-
each
_ child (2) -
each
_ entry (1) -
each
_ filename (1) -
each
_ line (2) - entries (1)
- eql? (1)
- executable? (1)
-
executable
_ real? (1) - exist? (1)
- extname (1)
- file? (1)
- find (2)
- fnmatch (1)
- fnmatch? (1)
- ftype (1)
- grpowned? (1)
- hash (1)
- join (1)
- lchmod (1)
- lchown (1)
- lstat (1)
-
make
_ link (1) -
make
_ symlink (1) - mkdir (1)
- mkpath (1)
- mountpoint? (1)
- mtime (1)
- open (2)
- opendir (2)
- owned? (1)
- parent (1)
- pipe? (1)
- read (1)
- readable? (1)
-
readable
_ real? (1) - readlines (1)
- readlink (1)
- realdirpath (1)
- realpath (2)
- relative? (1)
-
relative
_ path _ from (1) - rename (1)
- rmdir (1)
- rmtree (1)
- root? (1)
- setgid? (1)
- setuid? (1)
- size (1)
- size? (1)
- socket? (1)
- split (1)
- stat (1)
- sticky? (1)
- sub (2)
-
sub
_ ext (1) - symlink? (1)
- sysopen (1)
-
to
_ path (1) -
to
_ s (1) - truncate (1)
- unlink (1)
- utime (1)
-
world
_ readable? (1) -
world
_ writable? (1) - writable? (1)
-
writable
_ real? (1) - write (1)
- zero? (1)
検索結果
先頭5件
-
Pathname
# each _ child(with _ directory = true) {|pathname| . . . } -> [Pathname] (63979.0) -
self.children(with_directory).each と同じです。
...ruby]{
require "pathname"
Pathname("/usr/local").each_child {|f| p f }
# => #<Pathname:/usr/local/bin>
# => #<Pathname:/usr/local/etc>
# => #<Pathname:/usr/local/include>
# => #<Pathname:/usr/local/lib>
# => #<Pathname:/usr/local/opt>
# => #<Pathname:/usr/local/sbin>
# => #<Pathname:/usr/local/shar......e>
# => #<Pathname:/usr/local/var>
Pathname("/usr/local").each_child(false) {|f| p f }
# => #<Pathname:bin>
# => #<Pathname:etc>
# => #<Pathname:include>
# => #<Pathname:lib>
# => #<Pathname:opt>
# => #<Pathname:sbin>
# => #<Pathname:share>
# => #<Pathname:var>
//}
@see Pathname#children... -
Pathname
# sub _ ext(replace) -> Pathname (63598.0) -
拡張子を与えられた文字列で置き換えた Pathname オブジェクトを返します。
...置き換えた Pathname オブジェクトを返します。
自身が拡張子を持たない場合は、与えられた文字列を拡張子として付加します。
@param replace 拡張子を文字列で指定します。
//emlist[例][ruby]{
require "pathname"
Pathname('/usr/bin/shutdown......') # => #<Pathname:/usr/bin/shutdown.rb>
Pathname('/home/user/test.txt').sub_ext('.pdf') # => #<Pathname:/home/user/test.pdf>
Pathname('/home/user/test').sub_ext('.pdf') # => #<Pathname:/home/user/test.pdf>
Pathname('/home/user/test.').sub_ext('.pdf') # => #<Pathname:/home/user/tes......t..pdf>
Pathname('/home/user/.test').sub_ext('.pdf') # => #<Pathname:/home/user/.test.pdf>
Pathname('/home/user/test.tar.gz').sub_ext('.xz') # => #<Pathname:/home/user/test.tar.xz>
//}... -
Pathname
# ascend {|pathname| . . . } -> nil (63580.0) -
self のパス名から親方向に辿っていったときの各パス名を新しい Pathname オ ブジェクトとして生成し、ブロックへの引数として渡して実行します。 ブロックを省略した場合は Enumerator を返します。
...い Pathname オ
ブジェクトとして生成し、ブロックへの引数として渡して実行します。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
require 'pathname'
Pathname.new('/path/to/some/file.rb').ascend {|v| p v}
# => #<Pathname:/path/......o/some/file.rb>
# #<Pathname:/path/to/some>
# #<Pathname:/path/to>
# #<Pathname:/path>
# #<Pathname:/>
Pathname.new('path/to/some/file.rb').ascend {|v| p v}
# => #<Pathname:path/to/some/file.rb>
# #<Pathname:path/to/some>
# #<Pathname:path/to>
# #<Pathname:path>
//}
ファイ... -
Pathname
# descend {|pathname| . . . } -> nil (63580.0) -
self のパス名の親から子供へと辿っていったときの各パス名を新しい Pathname オブジェクトとして生成し、ブロックへの引数として渡して実行しま す。 ブロックを省略した場合は Enumerator を返します。
...い
Pathname オブジェクトとして生成し、ブロックへの引数として渡して実行しま
す。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
require 'pathname'
Pathname.new('/path/to/some/file.rb').descend {|v| p v}
# => #<Pathname:/>
#......#<Pathname:/path>
# #<Pathname:/path/to>
# #<Pathname:/path/to/some>
# #<Pathname:/path/to/some/file.rb>
Pathname.new('path/to/some/file.rb').descend {|v| p v}
# => #<Pathname:path>
# #<Pathname:path/to>
# #<Pathname:path/to/some>
# #<Pathname:path/to/some/file.rb>
//}
ファ... -
Pathname
# entries -> [Pathname] (63580.0) -
self に含まれるファイルエントリ名を元にした Pathname オブジェクトの配列を返します。
...した 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
# +(other) -> Pathname (63565.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 オブジェクトを指定します。... -
Pathname
# / (other) -> Pathname (63565.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 オブジェクトを指定します。... -
Pathname
# basename(suffix = "") -> Pathname (63562.0) -
Pathname.new(File.basename(self.to_s, suffix)) と同じです。
...Pathname.new(File.basename(self.to_s, suffix)) と同じです。
@param suffix サフィックスを文字列で与えます。'.*' という文字列を与えた場合、'*' はワイルドカードとして働き
'.' を含まない任意の文字列にマッチします。
//emli......require "pathname"
Pathname("ruby/ruby.c").basename #=> #<Pathname:"ruby.c">
Pathname("ruby/ruby.c").basename(".c") #=> #<Pathname:"ruby">
Pathname("ruby/ruby.c").basename(".*") #=> #<Pathname:"ruby">
Pathname("ruby/ruby.exe").basename(".*") #=> #<Pathname:"ruby">
Pathname("ruby/y.......tab.c").basename(".*") #=> #<Pathname:"y.tab">
//}
@see File.basename... -
Pathname
# each _ entry {|pathname| . . . } -> nil (63526.0) -
Dir.foreach(self.to_s) {|f| yield Pathname.new(f) } と同じです。
...to_s) {|f| yield Pathname.new(f) } と同じです。
//emlist[例][ruby]{
require "pathname"
Pathname("/usr/local").each_entry {|f| p f }
# => #<Pathname:.>
# => #<Pathname:..>
# => #<Pathname:bin>
# => #<Pathname:etc>
# => #<Pathname:include>
# => #<Pathname:lib>
# => #<Pathname:opt>
//}
@see... -
Pathname
# parent -> Pathname (63526.0) -
self の親ディレクトリを指す新しい Pathname オブジェクトを返します。
...を指す新しい Pathname オブジェクトを返します。
//emlist[例 絶対パス][ruby]{
require "pathname"
path = Pathname("/usr")
path # => #<Pathname:/usr>
path.parent # => #<Pathname:/>
//}
//emlist[例 相対パス][ruby]{
require "pathname"
path = Pathname("foo/bar")
path.......parent # => #<Pathname:foo>
path.parent.parent # => #<Pathname:.>
path.parent.parent.parent # => #<Pathname:..>
//}... -
Pathname
# cleanpath(consider _ symlink = false) -> Pathname (63508.0) -
余計な "."、".." や "/" を取り除いた新しい Pathname オブジェクトを返します。
...余計な "."、".." や "/" を取り除いた新しい Pathname オブジェクトを返します。
cleanpath は、実際にファイルシステムを参照することなく、文字列操作
だけで処理を行います。
@param consider_symlink 真ならパス要素にシンボリック......題ないように .. を残します。
//emlist[例][ruby]{
require "pathname"
path = Pathname.new("//.././../")
path # => #<Pathname://.././../>
path.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")
path = Pathname.new("bar/././//foo/../bar")
Dir.chdir("/tmp")
path.cleanpath # => #<Pathname:bar/bar>
path.cleanpath(true) # => #<Pathname:bar/foo/../bar>
//}... -
Pathname
# expand _ path(default _ dir = & # 39; . & # 39;) -> Pathname (63472.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
# realdirpath(basedir = nil) -> Pathname (63454.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
# relative _ path _ from(base _ directory) -> Pathname (63454.0) -
base_directory から self への相対パスを求め、その内容の新しい Pathname オブジェクトを生成して返します。
...base_directory から self への相対パスを求め、その内容の新しい Pathname
オブジェクトを生成して返します。
パス名の解決は文字列操作によって行われ、ファイルシステムをアクセス
しません。
self が相対パスなら base_directory......リを表す Pathname オブジェクトを指定します。
@raise ArgumentError Windows上でドライブが違うなど、base_directory から self への相対パスが求められないときに例外が発生します。
//emlist[例][ruby]{
require 'pathname'
path = Pathname.new("/tmp/fo......o")
base = Pathname.new("/tmp")
path.relative_path_from(base) # => #<Pathname:foo>
//}... -
Pathname
# realpath -> Pathname (63439.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 (63439.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
# children(with _ directory = true) -> [Pathname] (63436.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>, ... ]
//}... -
Pathname
# join(*args) -> Pathname (63424.0) -
与えられたパス名を連結します。
...[ruby]{
require "pathname"
path0 = Pathname("/usr") # Pathname:/usr
path0 = path0.join("bin/ruby") # Pathname:/usr/bin/ruby
# 上記の path0 の処理は下記の path1 と同様のパスになります
path1 = Pathname("/usr") + "bin/ruby" # Pathname:/usr/bin/ruby
pa... -
Pathname
# sub(pattern) {|matched| . . . } -> Pathname (63421.0) -
self を表現するパス文字列に対して sub メソッドを呼び出し、その結果を内 容とする新しい Pathname オブジェクトを生成し、返します。
...い Pathname オブジェクトを生成し、返します。
@param pattern 置き換える文字列のパターンを指定します。
@param replace pattern で指定した文字列と置き換える文字列を指定します。
//emlist[例][ruby]{
require 'pathname'
path1 = Pathname('/usr....../bin/perl')
path1.sub('perl', 'ruby') #=> #<Pathname:/usr/bin/ruby>
//}
@see String#sub... -
Pathname
# sub(pattern , replace) -> Pathname (63421.0) -
self を表現するパス文字列に対して sub メソッドを呼び出し、その結果を内 容とする新しい Pathname オブジェクトを生成し、返します。
...い Pathname オブジェクトを生成し、返します。
@param pattern 置き換える文字列のパターンを指定します。
@param replace pattern で指定した文字列と置き換える文字列を指定します。
//emlist[例][ruby]{
require 'pathname'
path1 = Pathname('/usr....../bin/perl')
path1.sub('perl', 'ruby') #=> #<Pathname:/usr/bin/ruby>
//}
@see String#sub... -
Pathname
# dirname -> Pathname (63418.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
# find(ignore _ error: true) {|pathname| . . . } -> nil (63382.0) -
self 配下のすべてのファイルやディレクトリを 一つずつ引数 pathname に渡してブロックを実行します。
...self 配下のすべてのファイルやディレクトリを
一つずつ引数 pathname に渡してブロックを実行します。
require 'find'
Find.find(self.to_s) {|f| yield Pathname.new(f)}
と同じです。
ブロックを省略した場合は Enumerator を返します。
@para... -
Pathname
# each _ child(with _ directory = true) -> Enumerator (63379.0) -
self.children(with_directory).each と同じです。
...ruby]{
require "pathname"
Pathname("/usr/local").each_child {|f| p f }
# => #<Pathname:/usr/local/bin>
# => #<Pathname:/usr/local/etc>
# => #<Pathname:/usr/local/include>
# => #<Pathname:/usr/local/lib>
# => #<Pathname:/usr/local/opt>
# => #<Pathname:/usr/local/sbin>
# => #<Pathname:/usr/local/shar......e>
# => #<Pathname:/usr/local/var>
Pathname("/usr/local").each_child(false) {|f| p f }
# => #<Pathname:bin>
# => #<Pathname:etc>
# => #<Pathname:include>
# => #<Pathname:lib>
# => #<Pathname:opt>
# => #<Pathname:sbin>
# => #<Pathname:share>
# => #<Pathname:var>
//}
@see Pathname#children... -
Pathname
# readlink -> Pathname (63364.0) -
Pathname.new(File.readlink(self.to_s)) と同じです。
...Pathname.new(File.readlink(self.to_s)) と同じです。
@see File.readlink... -
Pathname
# ascend -> Enumerator (63280.0) -
self のパス名から親方向に辿っていったときの各パス名を新しい Pathname オ ブジェクトとして生成し、ブロックへの引数として渡して実行します。 ブロックを省略した場合は Enumerator を返します。
...い Pathname オ
ブジェクトとして生成し、ブロックへの引数として渡して実行します。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
require 'pathname'
Pathname.new('/path/to/some/file.rb').ascend {|v| p v}
# => #<Pathname:/path/......o/some/file.rb>
# #<Pathname:/path/to/some>
# #<Pathname:/path/to>
# #<Pathname:/path>
# #<Pathname:/>
Pathname.new('path/to/some/file.rb').ascend {|v| p v}
# => #<Pathname:path/to/some/file.rb>
# #<Pathname:path/to/some>
# #<Pathname:path/to>
# #<Pathname:path>
//}
ファイ... -
Pathname
# descend -> Enumerator (63280.0) -
self のパス名の親から子供へと辿っていったときの各パス名を新しい Pathname オブジェクトとして生成し、ブロックへの引数として渡して実行しま す。 ブロックを省略した場合は Enumerator を返します。
...い
Pathname オブジェクトとして生成し、ブロックへの引数として渡して実行しま
す。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
require 'pathname'
Pathname.new('/path/to/some/file.rb').descend {|v| p v}
# => #<Pathname:/>
#......#<Pathname:/path>
# #<Pathname:/path/to>
# #<Pathname:/path/to/some>
# #<Pathname:/path/to/some/file.rb>
Pathname.new('path/to/some/file.rb').descend {|v| p v}
# => #<Pathname:path>
# #<Pathname:path/to>
# #<Pathname:path/to/some>
# #<Pathname:path/to/some/file.rb>
//}
ファ... -
Pathname
# <=>(other) -> -1 | 0 | 1 | nil (63205.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
# ==(other) -> bool (63205.0) -
パス名を比較し、 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")
# => true
# false
# false
//}... -
Pathname
# ===(other) -> bool (63205.0) -
パス名を比較し、 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")
# => true
# false
# false
//}... -
Pathname
# eql?(other) -> bool (63205.0) -
パス名を比較し、 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")
# => true
# false
# false
//}... -
Pathname
# each _ line(*args) -> Enumerator (63157.0) -
IO.foreach(self.to_s, *args, &block) と同じです。
...t[例][ruby]{
require "pathname"
IO.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line
# => #<Enumerator: IO:foreach("testfile")>
//}
//emlist[例 ブロックを指定][ruby]{
require "pathname"
IO.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line......uire "pathname"
IO.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line(4) {|f| p f }
# => "line"
# => "1\n"
# => "line"
# => "2,\n"
# => "line"
# => "3\n"
//}
//emlist[例 sep を指定][ruby]{
require "pathname"
IO.write("testfile", "line1\nline2,\nline3\n")
Pathname("tes... -
Pathname
# each _ line(*args) {|line| . . . } -> nil (63157.0) -
IO.foreach(self.to_s, *args, &block) と同じです。
...t[例][ruby]{
require "pathname"
IO.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line
# => #<Enumerator: IO:foreach("testfile")>
//}
//emlist[例 ブロックを指定][ruby]{
require "pathname"
IO.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line......uire "pathname"
IO.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line(4) {|f| p f }
# => "line"
# => "1\n"
# => "line"
# => "2,\n"
# => "line"
# => "3\n"
//}
//emlist[例 sep を指定][ruby]{
require "pathname"
IO.write("testfile", "line1\nline2,\nline3\n")
Pathname("tes... -
Pathname
# absolute? -> bool (63139.0) -
self が絶対パス指定であれば真を返します。
...self が絶対パス指定であれば真を返します。
//emlist[例][ruby]{
require "pathname"
pathname = Pathname("/path/to/example.rb")
pathname.absolute? # => true
pathname = Pathname("../")
pathname.absolute? # => false
//}... -
Pathname
# binread(*args) -> String | nil (63121.0) -
IO.binread(self.to_s, *args)と同じです。
...じです。
//emlist[例][ruby]{
require "pathname"
pathname = Pathname("testfile")
pathname.binread # => "This is line one\nThis is line two\nThis is line three\nAnd so on...\n"
pathname.binread(20) # => "This is line one\nThi"
pathname.binread(20, 10) # => "ne one\nThis is lin... -
Pathname
# ctime -> Time (63121.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
# delete -> Integer (63121.0) -
self が指すディレクトリあるいはファイルを削除します。
...self が指すディレクトリあるいはファイルを削除します。
//emlist[例][ruby]{
require "pathname"
pathname = Pathname("/path/to/sample")
pathname.exist? # => true
pathname.unlink # => 1
pathname.exist? # => false
//}... -
Pathname
# split -> Array (63121.0) -
File.split(self.to_s) と同じです。
...File.split(self.to_s) と同じです。
//emlist[例][ruby]{
require "pathname"
pathname = Pathname("/path/to/sample")
pathname.split # => [#<Pathname:/path/to>, #<Pathname:sample>]
//}
@see File.split... -
Pathname
# unlink -> Integer (63121.0) -
self が指すディレクトリあるいはファイルを削除します。
...self が指すディレクトリあるいはファイルを削除します。
//emlist[例][ruby]{
require "pathname"
pathname = Pathname("/path/to/sample")
pathname.exist? # => true
pathname.unlink # => 1
pathname.exist? # => false
//}... -
Pathname
# atime -> Time (63085.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
# chown(owner , group) -> Integer (63085.0) -
File.chown(owner, group, self.to_s) と同じです。
...。
@param owner オーナーを指定します。
@param group グループを指定します。
//emlist[例][ruby]{
require 'pathname'
Pathname('testfile').stat.uid # => 501
Pathname('testfile').chown(502, 12)
Pathname('testfile').stat.uid # => 502
//}
@see File.chown, File#chown... -
Pathname
# find(ignore _ error: true) -> Enumerator (63082.0) -
self 配下のすべてのファイルやディレクトリを 一つずつ引数 pathname に渡してブロックを実行します。
...self 配下のすべてのファイルやディレクトリを
一つずつ引数 pathname に渡してブロックを実行します。
require 'find'
Find.find(self.to_s) {|f| yield Pathname.new(f)}
と同じです。
ブロックを省略した場合は Enumerator を返します。
@para... -
Pathname
# to _ path -> String (63079.0) -
File.open などの引数に渡す際に呼ばれるメソッドです。 Pathname オブジェ クトにおいては、 to_s と同じです。
...File.open などの引数に渡す際に呼ばれるメソッドです。 Pathname オブジェ
クトにおいては、 to_s と同じです。
@see Pathname#to_s... -
Pathname
# mountpoint? -> bool (63067.0) -
self がマウントポイントであれば真を返します。
...self がマウントポイントであれば真を返します。
//emlist[例][ruby]{
require "pathname"
path = Pathname("/")
path.mountpoint? # => true
path = Pathname("/usr")
path.mountpoint? # => false
//}... -
Pathname
# relative? -> bool (63067.0) -
self が相対パス指定であれば真を返します。
...self が相対パス指定であれば真を返します。
//emlist[例][ruby]{
require 'pathname'
p = Pathname.new('/im/sure')
p.relative? #=> false
p = Pathname.new('not/so/sure')
p.relative? #=> true
//}... -
Pathname
# root? -> bool (63067.0) -
self がルートディレクトリであれば真を返します。判断は文字列操作によっ て行われ、ファイルシステムはアクセスされません。
...self がルートディレクトリであれば真を返します。判断は文字列操作によっ
て行われ、ファイルシステムはアクセスされません。
//emlist[例][ruby]{
require 'pathname'
Pathname('/').root? # => true
Pathname('/im/sure').root? # => false
//}... -
Pathname
# each _ filename {|v| . . . } -> nil (63049.0) -
self のパス名要素毎にブロックを実行します。
...self のパス名要素毎にブロックを実行します。
//emlist[例][ruby]{
require 'pathname'
Pathname.new("/foo/../bar").each_filename {|v| p v}
# => "foo"
# ".."
# "bar"
//}... -
Pathname
# fnmatch(pattern , *args) -> bool (63049.0) -
File.fnmatch(pattern, self.to_s, *args) と同じです。
...て `{}' や `**/' は使用できません。
@param args File.fnmatch を参照してください。
//emlist[例][ruby]{
require "pathname"
path = Pathname("testfile")
path.fnmatch("test*") # => true
path.fnmatch("TEST*") # => false
path.fnmatch("TES... -
Pathname
# to _ s -> String (63049.0) -
パス名を文字列で返します。
...パス名を文字列で返します。
//emlist[例][ruby]{
require 'pathname'
path = Pathname.new("/tmp/hogehoge")
File.open(path)
//}... -
Pathname
# binwrite(string , offset=nil) -> Integer (63013.0) -
IO.binwrite(self.to_s, *args)と同じです。
IO.binwrite(self.to_s, *args)と同じです。
@see IO.binwrite -
Pathname
# birthtime -> Time (63013.0) -
File.birthtime(self.to_s) を渡したものと同じです。
File.birthtime(self.to_s) を渡したものと同じです。
@raise NotImplementedError Windows のような birthtime のない環境で発生します。
@see File.birthtime -
Pathname
# blockdev? -> bool (63013.0) -
FileTest.blockdev?(self.to_s) と同じです。
FileTest.blockdev?(self.to_s) と同じです。
@see FileTest.#blockdev? -
Pathname
# chardev? -> bool (63013.0) -
FileTest.chardev?(self.to_s) と同じです。
FileTest.chardev?(self.to_s) と同じです。
@see FileTest.#chardev? -
Pathname
# chmod(mode) -> Integer (63013.0) -
File.chmod(mode, self.to_s) と同じです。
File.chmod(mode, self.to_s) と同じです。
@param mode ファイルのアクセス権限を整数で指定します。
@see File.chmod -
Pathname
# directory? -> bool (63013.0) -
FileTest.directory?(self.to_s) と同じです。
FileTest.directory?(self.to_s) と同じです。
@see FileTest.#directory? -
Pathname
# executable? -> bool (63013.0) -
FileTest.executable?(self.to_s) と同じです。
FileTest.executable?(self.to_s) と同じです。
@see FileTest.#executable? -
Pathname
# executable _ real? -> bool (63013.0) -
FileTest.executable_real?(self.to_s) と同じです。
FileTest.executable_real?(self.to_s) と同じです。
@see FileTest.#executable_real? -
Pathname
# exist? -> bool (63013.0) -
FileTest.exist?(self.to_s) と同じです。
FileTest.exist?(self.to_s) と同じです。
@see FileTest.#exist? -
Pathname
# extname -> String (63013.0) -
File.extname(self.to_s) と同じです。
File.extname(self.to_s) と同じです。
@see File.extname -
Pathname
# file? -> bool (63013.0) -
FileTest.file?(self.to_s) と同じです。
FileTest.file?(self.to_s) と同じです。
@see FileTest.#file? -
Pathname
# fnmatch?(pattern , *args) -> bool (63013.0) -
File.fnmatch?(pattern, self.to_s, *args) と同じです。
File.fnmatch?(pattern, self.to_s, *args) と同じです。
@param pattern パターンを文字列で指定します。ワイルドカードとして `*', `?', `[]' が使用できま
す。Dir.glob とは違って `{}' や `**/' は使用できません。
@param args File.fnmatch を参照してください。
@see File.fnmatch? -
Pathname
# ftype -> String (63013.0) -
File.ftype(self.to_s) と同じです。
File.ftype(self.to_s) と同じです。
@see File.ftype -
Pathname
# grpowned? -> bool (63013.0) -
FileTest.grpowned?(self.to_s) と同じです。
FileTest.grpowned?(self.to_s) と同じです。
@see FileTest.#grpowned? -
Pathname
# hash -> Integer (63013.0) -
ハッシュ値を返します。
ハッシュ値を返します。 -
Pathname
# lchmod(mode) -> Integer (63013.0) -
File.lchmod(mode, self.to_s) と同じです。
File.lchmod(mode, self.to_s) と同じです。
@param mode ファイルのアクセス権限を整数で指定します。
@see File.lchmod -
Pathname
# lchown(owner , group) -> Integer (63013.0) -
File.lchown(owner, group, self.to_s) と同じです。
File.lchown(owner, group, self.to_s) と同じです。
@param owner オーナーを指定します。
@param group グループを指定します。
@see File.lchown -
Pathname
# lstat -> File :: Stat (63013.0) -
File.lstat(self.to_s) と同じです。
File.lstat(self.to_s) と同じです。
@see File.lstat -
Pathname
# make _ link(old) -> 0 (63013.0) -
File.link(old, self.to_s) と同じです。
File.link(old, self.to_s) と同じです。
@see File.link -
Pathname
# make _ symlink(old) -> 0 (63013.0) -
File.symlink(old, self.to_s) と同じです。
File.symlink(old, self.to_s) と同じです。
@see File.symlink -
Pathname
# mkdir(*args) -> 0 (63013.0) -
Dir.mkdir(self.to_s, *args) と同じです。
Dir.mkdir(self.to_s, *args) と同じです。
@see Dir.mkdir -
Pathname
# mkpath -> nil (63013.0) -
FileUtils.mkpath(self.to_s) と同じです。
FileUtils.mkpath(self.to_s) と同じです。
@see FileUtils.#mkpath -
Pathname
# mtime -> Time (63013.0) -
File.mtime(self.to_s) を渡したものと同じです。
File.mtime(self.to_s) を渡したものと同じです。
@see File.mtime -
Pathname
# open(mode = & # 39;r& # 39; , perm = 0666) -> File (63013.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 (63013.0) -
File.open(self.to_s, *args, &block) と同じです。
File.open(self.to_s, *args, &block) と同じです。
@see File.open -
Pathname
# opendir -> Dir (63013.0) -
Dir.open(self.to_s, &block) と同じです。
Dir.open(self.to_s, &block) と同じです。
@see Dir.open -
Pathname
# opendir {|dir| . . . } -> nil (63013.0) -
Dir.open(self.to_s, &block) と同じです。
Dir.open(self.to_s, &block) と同じです。
@see Dir.open -
Pathname
# owned? -> bool (63013.0) -
FileTest.owned?(self.to_s) と同じです。
FileTest.owned?(self.to_s) と同じです。
@see FileTest.#owned? -
Pathname
# pipe? -> bool (63013.0) -
FileTest.pipe?(self.to_s) と同じです。
FileTest.pipe?(self.to_s) と同じです。
@see FileTest.#pipe? -
Pathname
# read(*args) -> String | nil (63013.0) -
IO.read(self.to_s, *args)と同じです。
IO.read(self.to_s, *args)と同じです。
@see IO.read -
Pathname
# readable? -> bool (63013.0) -
FileTest.readable?(self.to_s) と同じです。
FileTest.readable?(self.to_s) と同じです。
@see FileTest.#readable? -
Pathname
# readable _ real? -> bool (63013.0) -
FileTest.readable_real?(self.to_s) と同じです。
FileTest.readable_real?(self.to_s) と同じです。
@see FileTest.#readable_real? -
Pathname
# readlines(*args) -> [String] (63013.0) -
IO.readlines(self.to_s, *args)と同じです。
IO.readlines(self.to_s, *args)と同じです。
@see IO.readlines -
Pathname
# rename(to) -> 0 (63013.0) -
File.rename(self.to_s, to) と同じです。
File.rename(self.to_s, to) と同じです。
@param to ファイル名を表す文字列を指定します。
@see File.rename -
Pathname
# rmdir -> 0 (63013.0) -
Dir.rmdir(self.to_s) と同じです。
Dir.rmdir(self.to_s) と同じです。
@see Dir.rmdir -
Pathname
# rmtree -> nil (63013.0) -
FileUtils.rm_r(self.to_s) と同じです。
FileUtils.rm_r(self.to_s) と同じです。
@see FileUtils.#rm_r -
Pathname
# setgid? -> bool (63013.0) -
FileTest.setgid?(self.to_s) と同じです。
FileTest.setgid?(self.to_s) と同じです。
@see FileTest.#setgid? -
Pathname
# setuid? -> bool (63013.0) -
FileTest.setuid?(self.to_s) と同じです。
FileTest.setuid?(self.to_s) と同じです。
@see FileTest.#setuid? -
Pathname
# size -> Integer (63013.0) -
FileTest.size(self.to_s) と同じです。
FileTest.size(self.to_s) と同じです。
@see FileTest.#size -
Pathname
# size? -> bool (63013.0) -
FileTest.size?(self.to_s) と同じです。
FileTest.size?(self.to_s) と同じです。
@see FileTest.#size? -
Pathname
# socket? -> bool (63013.0) -
FileTest.socket?(self.to_s) と同じです。
FileTest.socket?(self.to_s) と同じです。
@see FileTest.#socket? -
Pathname
# stat -> File :: Stat (63013.0) -
File.stat(self.to_s) と同じです。
File.stat(self.to_s) と同じです。
@see File.stat -
Pathname
# sticky? -> bool (63013.0) -
FileTest.sticky?(self.to_s) と同じです。
FileTest.sticky?(self.to_s) と同じです。
@see FileTest.#sticky? -
Pathname
# symlink? -> bool (63013.0) -
FileTest.symlink?(self.to_s) と同じです。
FileTest.symlink?(self.to_s) と同じです。
@see FileTest.#symlink? -
Pathname
# sysopen(*args) -> Integer (63013.0) -
IO.sysopen(self.to_s, *args)と同じです。
IO.sysopen(self.to_s, *args)と同じです。
@see IO.sysopen -
Pathname
# truncate(length) -> 0 (63013.0) -
File.truncate(self.to_s, length) と同じです。
File.truncate(self.to_s, length) と同じです。
@param length 変更したいサイズを整数で与えます。
@see File.truncate -
Pathname
# utime(atime , mtime) -> Integer (63013.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
# world _ readable? -> bool (63013.0) -
FileTest.world_readable?(self.to_s) と同じです。
FileTest.world_readable?(self.to_s) と同じです。
@see FileTest.#world_readable? -
Pathname
# world _ writable? -> bool (63013.0) -
FileTest.world_writable?(self.to_s) と同じです。
FileTest.world_writable?(self.to_s) と同じです。
@see FileTest.#world_writable? -
Pathname
# writable? -> bool (63013.0) -
FileTest.writable?(self.to_s) と同じです。
FileTest.writable?(self.to_s) と同じです。
@see FileTest.#writable? -
Pathname
# writable _ real? -> bool (63013.0) -
FileTest.writable_real?(self.to_s) と同じです。
FileTest.writable_real?(self.to_s) と同じです。
@see FileTest.#writable_real? -
Pathname
# write(string , offset=nil , **opts) -> Integer (63013.0) -
IO.write(self.to_s, string, offset, **opts)と同じです。
@see IO.write