るりまサーチ

最速Rubyリファレンスマニュアル検索!
164件ヒット [1-100件を表示] (0.154秒)
トップページ > 種類:インスタンスメソッド[x] > クエリ:p[x] > クエリ:y[x] > クラス:Pathname[x]

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. dh p
  5. rsa p

ライブラリ

キーワード

検索結果

<< 1 2 > >>

Pathname#empty? -> bool (12202.0)

ディレクトリに対しては Dir.empty?(self.to_s) と同じ、他に対しては FileTest.empty?(self.to_s) と同じです。

...ては Dir.empty?(self.to_s) と同じ、他に対しては FileTest.empty?(self.to_s) と同じです。

//emlist[例 ディレクトリの場合][ruby]{
require "pathname"
require 'tmpdir'

Pathname
("/usr/local").empty? # => false
Dir.mktmpdir { |dir| Pathname(dir).empty? } # => tru...
...e
//}

//emlist[例 ファイルの場合][ruby]{
require "pathname"
require 'tempfile'

Pathname
("testfile").empty? # => false
Tempfile.create("tmp") { |tmp| Pathname(tmp).empty? } # => true
//}

@see Dir.empty?, FileTest.#empty?, Pathname#zero?...

Pathname#ftype -> String (12202.0)

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

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


@see File.ftype...

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

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

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


@see IO.sysopen...

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

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

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

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

@param consider_symlink 真ならパス要素にシンボリックリン...
...by]{
require "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#relative_path_from(base_directory) -> Pathname (9302.0)

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

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

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

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

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

@raise ArgumentError Windows上でドライブが違うなど、base_directory から self への相対パス...
...が求められないときに例外が発生します。

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

p
ath = Pathname.new("/tmp/foo")
base = Pathname.new("/tmp")

p
ath.relative_path_from(base) # => #<Pathname:foo>
//}...

絞り込み条件を変える

Pathname#each_entry {|pathname| ... } -> nil (9208.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>
//}

@se...
...f| yield Pathname.new(f) } と同じです。

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

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

Pathname
("/usr/local").each_entry {|f| p f }

# => #<Pathname:.>
# => #<Pathname:..>
# => #<Pathname:bin>
# => #<Pathname:etc>
# => #<Pathname:i...
...nclude>
# => #<Pathname:lib>
# => #<Pathname:opt>
//}

@see Dir.foreach...

Pathname#each_entry -> Enumerator (9108.0)

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

...f| yield Pathname.new(f) } と同じです。

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

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

Pathname
("/usr/local").each_entry {|f| p f }

# => #<Pathname:.>
# => #<Pathname:..>
# => #<Pathname:bin>
# => #<Pathname:etc>
# => #<Pathname:i...
...nclude>
# => #<Pathname:lib>
# => #<Pathname:opt>
//}

@see Dir.foreach...

Pathname#directory? -> bool (9102.0)

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

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


@see FileTest.#directory?...

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

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

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


@see File.symlink...

Pathname#sticky? -> bool (9102.0)

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

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


@see FileTest.#sticky?...

絞り込み条件を変える

Pathname#symlink? -> bool (9102.0)

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

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


@see FileTest.#symlink?...
<< 1 2 > >>