るりまサーチ (Ruby 2.3.0)

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

別のキーワード

  1. rake ext
  2. irb/ext/save-history save_history
  3. pathname sub_ext
  4. irb/ext/tracer use_tracer=
  5. irb/ext/tracer use_tracer

ライブラリ

クラス

検索結果

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

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

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

自身が拡張子を持たない場合は、与えられた文字列を拡張子として付加します。

@param replace 拡張子を文字列で指定します。

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

Pathname('/usr/bin/shutdown').sub_ext('.rb') # => #<Pathname:/usr/bin/shutdown.rb>
Pathname('/home/user/test.txt').sub_ext('.pdf') # => #<Path...