るりまサーチ

最速Rubyリファレンスマニュアル検索!
1511件ヒット [1-100件を表示] (0.056秒)
トップページ > クエリ:-[x] > クエリ:Pathname[x]

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method new
  4. irb/input-method gets
  5. matrix -

ライブラリ

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Pathname#each_child(with_directory = true) {|pathname| ...} -> [Pathname] (21422.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 (21295.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 (21289.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 (21289.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] (21289.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 (21284.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 (21284.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 (21283.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 (21283.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#glob(pattern, flags=0) -> [Pathname] (21272.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 (21272.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...
<< 1 2 3 ... > >>