るりまサーチ (Ruby 2.2.0)

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

別のキーワード

  1. pathname glob
  2. pathname sub
  3. pathname find
  4. pathname open
  5. pathname ascend

モジュール

検索結果

<< 1 2 > >>

Pathname (114235.0)

パス名をオブジェクト指向らしく扱うクラスです。

パス名をオブジェクト指向らしく扱うクラスです。

Pathname オブジェクトはパス名を表しており、ファイルやディレクトリそのものを表してはいません。
当然、存在しないファイルのパス名も扱えます。

絶対パスも相対パスも扱えます。

Pathname オブジェクトは immutable であり、自身を破壊的に操作するメソッドはありません。

Pathname のインスタンスメソッドには、ディレクトリのパスを返す Pathname#dirname のように、
文字列操作だけで結果を返すものもあれば、ファイルの中身を読み出す Pathname#read のように
ファイルシステムにアクセスするも...

Pathname#each_child(with_directory = true) {|pathname| ...} -> [Pathname] (63967.0)

self.children(with_directory).each と同じです。

self.children(with_directory).each と同じです。

@param with_directory 偽を指定するとファイル名のみ返します。デフォルトは真です。

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

Pathname("/usr/local").each_child {|f| p f }
# => #<Pathname:/usr/local/bin>
# => #<Pathname:/usr/local/etc>
# => #<Pathname:/usr/local/include>
# => #<Pathname:/us...

Pathname#sub_ext(replace) -> Pathname (63586.0)

拡張子を与えられた文字列で置き換えた Pathname オブジェクトを返します。

拡張子を与えられた文字列で置き換えた Pathname オブジェクトを返します。

自身が拡張子を持たない場合は、与えられた文字列を拡張子として付加します。

@param replace 拡張子を文字列で指定します。

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

Pathname('/usr/bin/shutdown').sub_ext('.rb') # => #<Pathname:/usr/bin/shutdown.rb>
Pathname('/home/user/test.txt').sub_ext('.pdf') # => #<Path...

Pathname#ascend {|pathname| ... } -> nil (63568.0)

self のパス名から親方向に辿っていったときの各パス名を新しい Pathname オ ブジェクトとして生成し、ブロックへの引数として渡して実行します。 ブロックを省略した場合は Enumerator を返します。

self のパス名から親方向に辿っていったときの各パス名を新しい Pathname オ
ブジェクトとして生成し、ブロックへの引数として渡して実行します。
ブロックを省略した場合は Enumerator を返します。

//emlist[例][ruby]{
require '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#descend {|pathname| ... } -> nil (63568.0)

self のパス名の親から子供へと辿っていったときの各パス名を新しい Pathname オブジェクトとして生成し、ブロックへの引数として渡して実行しま す。 ブロックを省略した場合は Enumerator を返します。

self のパス名の親から子供へと辿っていったときの各パス名を新しい
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/s...

絞り込み条件を変える

Pathname#entries -> [Pathname] (63568.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>,
# #<Pathnam...

Pathname#+(other) -> Pathname (63553.0)

パス名を連結します。つまり、other を self からの相対パスとした新しい Pathname オブジェクトを生成して返します。

パス名を連結します。つまり、other を self からの相対パスとした新しい
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#/(other) -> Pathname (63553.0)

パス名を連結します。つまり、other を self からの相対パスとした新しい Pathname オブジェクトを生成して返します。

パス名を連結します。つまり、other を self からの相対パスとした新しい
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#basename(suffix = "") -> Pathname (63550.0)

Pathname.new(File.basename(self.to_s, suffix)) と同じです。

Pathname.new(File.basename(self.to_s, suffix)) と同じです。

@param suffix サフィックスを文字列で与えます。'.*' という文字列を与えた場合、'*' はワイルドカードとして働き
'.' を含まない任意の文字列にマッチします。

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

Pathname("ruby/ruby.c").basename #=> #<Pathname:"ruby.c">
Pathname("ruby/ruby.c").basename("...

Pathname#each_entry {|pathname| ... } -> nil (63514.0)

Dir.foreach(self.to_s) {|f| yield Pathname.new(f) } と同じです。

Dir.foreach(self.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>
//}

@...

絞り込み条件を変える

Pathname#parent -> Pathname (63514.0)

self の親ディレクトリを指す新しい Pathname オブジェクトを返します。

self の親ディレクトリを指す新しい 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>
p...

Pathname#cleanpath(consider_symlink = false) -> Pathname (63496.0)

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

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

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

@param consider_symlink 真ならパス要素にシンボリックリンクがあった場合
にも問題ないように .. を残します。

//emlist[例][ruby]{
require "pathname"
path = Pathname.new("//.././../")
path # => #<Pa...

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

Pathname.getwd -> Pathname (63457.0)

カレントディレクトリを元に Pathname オブジェクトを生成します。 Pathname.new(Dir.getwd) と同じです。

カレントディレクトリを元に Pathname オブジェクトを生成します。
Pathname.new(Dir.getwd) と同じです。

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

Pathname.getwd #=> #<Pathname:/home/zzak/projects/ruby>
//}

@see Dir.getwd

Pathname.pwd -> Pathname (63457.0)

カレントディレクトリを元に Pathname オブジェクトを生成します。 Pathname.new(Dir.getwd) と同じです。

カレントディレクトリを元に Pathname オブジェクトを生成します。
Pathname.new(Dir.getwd) と同じです。

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

Pathname.getwd #=> #<Pathname:/home/zzak/projects/ruby>
//}

@see Dir.getwd

絞り込み条件を変える

Pathname.glob(pattern, flags=0) -> [Pathname] (63445.0)

ワイルドカードの展開を行なった結果を、 Pathname オブジェクトの配列として返します。

ワイルドカードの展開を行なった結果を、
Pathname オブジェクトの配列として返します。

引数の意味は、Dir.glob と同じです。 flag の初期値である 0 は「何
も指定しない」ことを意味します。

ブロックが与えられたときは、ワイルドカードにマッチした Pathname オブジェ
クトを1つずつ引数としてそのブロックに与えて実行させます。この場合、値と
しては nil を返します。

@param pattern ワイルドカードパターンです
@param flags パターンマッチ時のふるまいを変化させるフラグを指定します

//emlist[][ruby]{
requ...

Pathname.glob(pattern, flags=0) {|pathname| ...} -> nil (63445.0)

ワイルドカードの展開を行なった結果を、 Pathname オブジェクトの配列として返します。

ワイルドカードの展開を行なった結果を、
Pathname オブジェクトの配列として返します。

引数の意味は、Dir.glob と同じです。 flag の初期値である 0 は「何
も指定しない」ことを意味します。

ブロックが与えられたときは、ワイルドカードにマッチした Pathname オブジェ
クトを1つずつ引数としてそのブロックに与えて実行させます。この場合、値と
しては nil を返します。

@param pattern ワイルドカードパターンです
@param flags パターンマッチ時のふるまいを変化させるフラグを指定します

//emlist[][ruby]{
requ...

Pathname#realdirpath(basedir = nil) -> Pathname (63442.0)

Pathname#realpath とほぼ同じで、最後のコンポーネントは実際に 存在しなくてもエラーになりません。

Pathname#realpath とほぼ同じで、最後のコンポーネントは実際に
存在しなくてもエラーになりません。

@param basedir ベースディレクトリを指定します。省略するとカレントディレクトリになります。

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

path = Pathname("/not_exist")
path.realdirpath # => #<Pathname:/not_exist>
path.realpath # => Errno::ENOENT

# 最後ではないコンポーネント(/not_exist_1)も存在し...

Pathname#relative_path_from(base_directory) -> Pathname (63442.0)

base_directory から self への相対パスを求め、その内容の新しい Pathname オブジェクトを生成して返します。

base_directory から self への相対パスを求め、その内容の新しい Pathname
オブジェクトを生成して返します。

パス名の解決は文字列操作によって行われ、ファイルシステムをアクセス
しません。

self が相対パスなら base_directory も相対パス、self が絶対パスなら
base_directory も絶対パスでなければなりません。

@param base_directory ベースディレクトリを表す Pathname オブジェクトを指定します。

@raise ArgumentError Windows上でドライブが違うなど、base_direct...

Pathname#realpath -> Pathname (63427.0)

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

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

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

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

@param basedir ベースディレクトリを指定します。省略するとカレントディレクトリになります。

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

Dir.rmdir("/tmp/foo") rescue nil
File.unlink("/tmp/b...

絞り込み条件を変える

Pathname#realpath(basedir = nil) -> Pathname (63427.0)

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

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

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

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

@param basedir ベースディレクトリを指定します。省略するとカレントディレクトリになります。

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

Dir.rmdir("/tmp/foo") rescue nil
File.unlink("/tmp/b...

Pathname#children(with_directory = true) -> [Pathname] (63424.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 (63412.0)

与えられたパス名を連結します。

与えられたパス名を連結します。

@param args 連結したいディレクトリ名やファイル名を文字列で与えます。

//emlist[例][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#sub(pattern) {|matched| ... } -> Pathname (63409.0)

self を表現するパス文字列に対して sub メソッドを呼び出し、その結果を内 容とする新しい Pathname オブジェクトを生成し、返します。

self を表現するパス文字列に対して sub メソッドを呼び出し、その結果を内
容とする新しい Pathname オブジェクトを生成し、返します。

@param pattern 置き換える文字列のパターンを指定します。

@param replace pattern で指定した文字列と置き換える文字列を指定します。

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

path1 = Pathname('/usr/bin/perl')
path1.sub('perl', 'ruby') #=> #<Pathname:/usr/bin/ruby>
//}

@se...

Pathname#sub(pattern, replace) -> Pathname (63409.0)

self を表現するパス文字列に対して sub メソッドを呼び出し、その結果を内 容とする新しい Pathname オブジェクトを生成し、返します。

self を表現するパス文字列に対して sub メソッドを呼び出し、その結果を内
容とする新しい Pathname オブジェクトを生成し、返します。

@param pattern 置き換える文字列のパターンを指定します。

@param replace pattern で指定した文字列と置き換える文字列を指定します。

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

path1 = Pathname('/usr/bin/perl')
path1.sub('perl', 'ruby') #=> #<Pathname:/usr/bin/ruby>
//}

@se...

絞り込み条件を変える

Pathname#dirname -> Pathname (63406.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.new(path) -> Pathname (63406.0)

文字列 path を元に Pathname オブジェクトを生成します。

文字列 path を元に Pathname オブジェクトを生成します。

@param path 文字列、または類似のオブジェクトを与えます。
実際には to_str に反応するオブジェクトなら何でも構いません。

@raise ArgumentError path が \0 を含んでいると発生します。

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

Pathname.new(__FILE__) # => #<Pathname:/path/to/file.rb>
//}

Pathname#find(ignore_error: true) {|pathname| ...} -> nil (63370.0)

self 配下のすべてのファイルやディレクトリを 一つずつ引数 pathname に渡してブロックを実行します。

self 配下のすべてのファイルやディレクトリを
一つずつ引数 pathname に渡してブロックを実行します。

require 'find'
Find.find(self.to_s) {|f| yield Pathname.new(f)}

と同じです。

ブロックを省略した場合は Enumerator を返します。

@param ignore_error 探索中に発生した例外を無視するかどうかを指定します。

@see Find.#find

Pathname#each_child(with_directory = true) -> Enumerator (63367.0)

self.children(with_directory).each と同じです。

self.children(with_directory).each と同じです。

@param with_directory 偽を指定するとファイル名のみ返します。デフォルトは真です。

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

Pathname("/usr/local").each_child {|f| p f }
# => #<Pathname:/usr/local/bin>
# => #<Pathname:/usr/local/etc>
# => #<Pathname:/usr/local/include>
# => #<Pathname:/us...

Pathname#readlink -> Pathname (63352.0)

Pathname.new(File.readlink(self.to_s)) と同じです。

Pathname.new(File.readlink(self.to_s)) と同じです。


@see File.readlink

絞り込み条件を変える

Pathname#ascend -> Enumerator (63268.0)

self のパス名から親方向に辿っていったときの各パス名を新しい Pathname オ ブジェクトとして生成し、ブロックへの引数として渡して実行します。 ブロックを省略した場合は Enumerator を返します。

self のパス名から親方向に辿っていったときの各パス名を新しい Pathname オ
ブジェクトとして生成し、ブロックへの引数として渡して実行します。
ブロックを省略した場合は Enumerator を返します。

//emlist[例][ruby]{
require '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#descend -> Enumerator (63268.0)

self のパス名の親から子供へと辿っていったときの各パス名を新しい Pathname オブジェクトとして生成し、ブロックへの引数として渡して実行しま す。 ブロックを省略した場合は Enumerator を返します。

self のパス名の親から子供へと辿っていったときの各パス名を新しい
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/s...

Pathname#<=>(other) -> -1 | 0 | 1 | nil (63193.0)

パス名を比較します。other と同じなら 0 を、ASCII順で self が大きい場合 は正、other が大きい場合は負を返します。大文字小文字は区別されます。 other は Pathname オブジェクトでなければなりません。

パス名を比較します。other と同じなら 0 を、ASCII順で self が大きい場合
は正、other が大きい場合は負を返します。大文字小文字は区別されます。
other は Pathname オブジェクトでなければなりません。

パス名の比較は単純にパス文字列の比較によって行われるので、論理的に
同じパスでもパス文字列が違えば異なると判断されます。

@param other 比較対象の Pathname オブジェクトを指定します。

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

p Pathname.new("foo/bar") <=> Pathn...

Pathname#==(other) -> bool (63193.0)

パス名を比較し、 other と同じなら真を返します。大文字小文字は区別されます。 other は Pathname オブジェクトでなければなりません。

パス名を比較し、 other と同じなら真を返します。大文字小文字は区別されます。
other は Pathname オブジェクトでなければなりません。

パス名の比較は単純にパス文字列の比較によって行われるので、論理的に
同じパスでもパス文字列が違えば異なると判断されます。

@param other 比較対象の Pathname オブジェクトを指定します。

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

p Pathname.new("foo/bar") == Pathname.new("foo/bar")
p Pathname.new("foo/bar"...

Pathname#===(other) -> bool (63193.0)

パス名を比較し、 other と同じなら真を返します。大文字小文字は区別されます。 other は Pathname オブジェクトでなければなりません。

パス名を比較し、 other と同じなら真を返します。大文字小文字は区別されます。
other は Pathname オブジェクトでなければなりません。

パス名の比較は単純にパス文字列の比較によって行われるので、論理的に
同じパスでもパス文字列が違えば異なると判断されます。

@param other 比較対象の Pathname オブジェクトを指定します。

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

p Pathname.new("foo/bar") == Pathname.new("foo/bar")
p Pathname.new("foo/bar"...

絞り込み条件を変える

Pathname#eql?(other) -> bool (63193.0)

パス名を比較し、 other と同じなら真を返します。大文字小文字は区別されます。 other は Pathname オブジェクトでなければなりません。

パス名を比較し、 other と同じなら真を返します。大文字小文字は区別されます。
other は Pathname オブジェクトでなければなりません。

パス名の比較は単純にパス文字列の比較によって行われるので、論理的に
同じパスでもパス文字列が違えば異なると判断されます。

@param other 比較対象の Pathname オブジェクトを指定します。

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

p Pathname.new("foo/bar") == Pathname.new("foo/bar")
p Pathname.new("foo/bar"...

Pathname#each_line(*args) -> Enumerator (63145.0)

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

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

//emlist[例][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\...

Pathname#each_line(*args) {|line| ... } -> nil (63145.0)

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

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

//emlist[例][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\...

Pathname#absolute? -> bool (63127.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 (63109.0)

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

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) # => ...

絞り込み条件を変える

Pathname#ctime -> Time (63109.0)

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

File.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 (63109.0)

self が指すディレクトリあるいはファイルを削除します。

self が指すディレクトリあるいはファイルを削除します。

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

pathname = Pathname("/path/to/sample")
pathname.exist? # => true
pathname.unlink # => 1
pathname.exist? # => false
//}

Pathname#split -> Array (63109.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 (63109.0)

self が指すディレクトリあるいはファイルを削除します。

self が指すディレクトリあるいはファイルを削除します。

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

pathname = Pathname("/path/to/sample")
pathname.exist? # => true
pathname.unlink # => 1
pathname.exist? # => false
//}

Pathname#atime -> Time (63073.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 (63073.0)

File.chown(owner, group, self.to_s) と同じです。

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 (63070.0)

self 配下のすべてのファイルやディレクトリを 一つずつ引数 pathname に渡してブロックを実行します。

self 配下のすべてのファイルやディレクトリを
一つずつ引数 pathname に渡してブロックを実行します。

require 'find'
Find.find(self.to_s) {|f| yield Pathname.new(f)}

と同じです。

ブロックを省略した場合は Enumerator を返します。

@param ignore_error 探索中に発生した例外を無視するかどうかを指定します。

@see Find.#find

Pathname#to_path -> String (63067.0)

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

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


@see Pathname#to_s

Pathname#mountpoint? -> bool (63055.0)

self がマウントポイントであれば真を返します。

self がマウントポイントであれば真を返します。

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

path = Pathname("/")
path.mountpoint? # => true
path = Pathname("/usr")
path.mountpoint? # => false
//}

Pathname#relative? -> bool (63055.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 (63055.0)

self がルートディレクトリであれば真を返します。判断は文字列操作によっ て行われ、ファイルシステムはアクセスされません。

self がルートディレクトリであれば真を返します。判断は文字列操作によっ
て行われ、ファイルシステムはアクセスされません。

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

Pathname('/').root? # => true
Pathname('/im/sure').root? # => false
//}

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

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

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

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

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

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

Pathname#fnmatch(pattern, *args) -> bool (63037.0)

File.fnmatch(pattern, self.to_s, *args) と同じです。

File.fnmatch(pattern, self.to_s, *args) と同じです。

@param pattern パターンを文字列で指定します。ワイルドカードとして `*', `?', `[]' が使用できま
す。Dir.glob とは違って `{}' や `**/' は使用できません。

@param args File.fnmatch を参照してください。

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

path = Pathname("testfile")
path.fnmatch("test*") ...

Pathname#to_s -> String (63037.0)

パス名を文字列で返します。

パス名を文字列で返します。


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

path = Pathname.new("/tmp/hogehoge")
File.open(path)
//}

Pathname#binwrite(string, offset=nil) -> Integer (63001.0)

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

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


@see IO.binwrite

絞り込み条件を変える

Pathname#birthtime -> Time (63001.0)

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

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

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


@see File.birthtime

Pathname#blockdev? -> bool (63001.0)

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

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


@see FileTest.#blockdev?

Pathname#chardev? -> bool (63001.0)

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

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


@see FileTest.#chardev?

Pathname#chmod(mode) -> Integer (63001.0)

File.chmod(mode, self.to_s) と同じです。

File.chmod(mode, self.to_s) と同じです。

@param mode ファイルのアクセス権限を整数で指定します。


@see File.chmod

Pathname#directory? -> bool (63001.0)

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

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


@see FileTest.#directory?

絞り込み条件を変える

Pathname#executable? -> bool (63001.0)

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

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


@see FileTest.#executable?

Pathname#executable_real? -> bool (63001.0)

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

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


@see FileTest.#executable_real?

Pathname#exist? -> bool (63001.0)

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

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


@see FileTest.#exist?

Pathname#extname -> String (63001.0)

File.extname(self.to_s) と同じです。

File.extname(self.to_s) と同じです。


@see File.extname

Pathname#file? -> bool (63001.0)

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

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


@see FileTest.#file?

絞り込み条件を変える

Pathname#fnmatch?(pattern, *args) -> bool (63001.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 (63001.0)

File.ftype(self.to_s) と同じです。

File.ftype(self.to_s) と同じです。


@see File.ftype

Pathname#grpowned? -> bool (63001.0)

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

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


@see FileTest.#grpowned?

Pathname#hash -> Integer (63001.0)

ハッシュ値を返します。

ハッシュ値を返します。

Pathname#lchmod(mode) -> Integer (63001.0)

File.lchmod(mode, self.to_s) と同じです。

File.lchmod(mode, self.to_s) と同じです。

@param mode ファイルのアクセス権限を整数で指定します。


@see File.lchmod

絞り込み条件を変える

Pathname#lchown(owner, group) -> Integer (63001.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 (63001.0)

File.lstat(self.to_s) と同じです。

File.lstat(self.to_s) と同じです。


@see File.lstat

Pathname#make_link(old) -> 0 (63001.0)

File.link(old, self.to_s) と同じです。

File.link(old, self.to_s) と同じです。


@see File.link

Pathname#make_symlink(old) -> 0 (63001.0)

File.symlink(old, self.to_s) と同じです。

File.symlink(old, self.to_s) と同じです。


@see File.symlink

Pathname#mkdir(*args) -> 0 (63001.0)

Dir.mkdir(self.to_s, *args) と同じです。

Dir.mkdir(self.to_s, *args) と同じです。


@see Dir.mkdir

絞り込み条件を変える

Pathname#mkpath -> nil (63001.0)

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

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


@see FileUtils.#mkpath

Pathname#mtime -> Time (63001.0)

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

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


@see File.mtime

Pathname#open(mode = &#39;r&#39;, perm = 0666) -> File (63001.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 (63001.0)

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

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


@see File.open

Pathname#opendir -> Dir (63001.0)

Dir.open(self.to_s, &block) と同じです。

Dir.open(self.to_s, &block) と同じです。


@see Dir.open

絞り込み条件を変える

Pathname#opendir {|dir| ... } -> nil (63001.0)

Dir.open(self.to_s, &block) と同じです。

Dir.open(self.to_s, &block) と同じです。


@see Dir.open

Pathname#owned? -> bool (63001.0)

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

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


@see FileTest.#owned?

Pathname#pipe? -> bool (63001.0)

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

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


@see FileTest.#pipe?

Pathname#read(*args) -> String | nil (63001.0)

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

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


@see IO.read

Pathname#readable? -> bool (63001.0)

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

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


@see FileTest.#readable?

絞り込み条件を変える

Pathname#readable_real? -> bool (63001.0)

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

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


@see FileTest.#readable_real?

Pathname#readlines(*args) -> [String] (63001.0)

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

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


@see IO.readlines

Pathname#rename(to) -> 0 (63001.0)

File.rename(self.to_s, to) と同じです。

File.rename(self.to_s, to) と同じです。

@param to ファイル名を表す文字列を指定します。


@see File.rename

Pathname#rmdir -> 0 (63001.0)

Dir.rmdir(self.to_s) と同じです。

Dir.rmdir(self.to_s) と同じです。


@see Dir.rmdir

Pathname#rmtree -> nil (63001.0)

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

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


@see FileUtils.#rm_r

絞り込み条件を変える

Pathname#setgid? -> bool (63001.0)

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

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


@see FileTest.#setgid?

Pathname#setuid? -> bool (63001.0)

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

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


@see FileTest.#setuid?

Pathname#size -> Integer (63001.0)

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

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


@see FileTest.#size

Pathname#size? -> bool (63001.0)

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

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


@see FileTest.#size?

Pathname#socket? -> bool (63001.0)

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

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


@see FileTest.#socket?

絞り込み条件を変える

Pathname#stat -> File::Stat (63001.0)

File.stat(self.to_s) と同じです。

File.stat(self.to_s) と同じです。


@see File.stat

Pathname#sticky? -> bool (63001.0)

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

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


@see FileTest.#sticky?

Pathname#symlink? -> bool (63001.0)

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

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


@see FileTest.#symlink?

Pathname#sysopen(*args) -> Integer (63001.0)

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

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


@see IO.sysopen

Pathname#truncate(length) -> 0 (63001.0)

File.truncate(self.to_s, length) と同じです。

File.truncate(self.to_s, length) と同じです。


@param length 変更したいサイズを整数で与えます。

@see File.truncate

絞り込み条件を変える

<< 1 2 > >>