るりまサーチ

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

別のキーワード

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

ライブラリ

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Net::FTP::MLSxEntry#pathname -> String (18102.0)

パス名を返します。

パス名を返します。

Pathname#each_child(with_directory = true) {|pathname| ...} -> [Pathname] (17323.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 (17196.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 (17190.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 (17190.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] (17190.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 (17185.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 (17185.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 (17184.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 (17184.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 (17172.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...
<< 1 2 3 ... > >>