Skip to content
instance method

Pathname#sub

(::Regexp | ::string pattern, ::string | ::Hash[::String, ::String] replacement) -> ::Pathname
(::Regexp | ::string pattern) { (::String match) -> ::string } -> ::Pathname
sub(*args)

Return a pathname which is substituted by String#sub.

Example
path1 = Pathname.new('/usr/bin/perl')
path1.sub('perl', 'ruby')
    #=> #<Pathname:/usr/bin/ruby>
See also #sticky? #sub_ext #stat #symlink? also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0