るりまサーチ

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

別のキーワード

  1. _builtin >
  2. bigdecimal >
  3. module >
  4. complex >
  5. comparable >

ライブラリ

クラス

検索結果

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

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

...lace 拡張子を文字列で指定します。

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

Pathname('/usr/bin/shutdown').sub_ext('.rb') # => #<Pathname:/usr/bin/shutdown.rb>
Pathname('/home/user/test.txt').sub_ext('.pdf') # => #<Pathname:/home/user/test.pdf>
Pathname('/home/user/test').sub_ext...
...=> #<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/.test.pdf>
Pathname('/home/user/test.tar.gz').sub_ext('.xz') # => #<Pathname:/home/user/test.tar.xz>...