るりまサーチ (Ruby 2.4.0)

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

別のキーワード

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

クラス

検索結果

Pathname#sub(pattern) {|matched| ... } -> Pathname (105805.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 (105805.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_ext(replace) -> Pathname (70003.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>
//}...