sub(*args)
public
Return a pathname which is substituted by String#sub.
path1 = Pathname.new('/usr/bin/perl')
path1.sub('perl', 'ruby')
Show source
static VALUE
path_sub(int argc, VALUE *argv, VALUE self)
{
VALUE str = get_strpath(self);
if (rb_block_given_p()) {
str = rb_block_call(str, rb_intern("sub"), argc, argv, 0, 0);
}
else {
str = rb_funcall2(str, rb_intern("sub"), argc, argv);
}
return rb_class_new_instance(1, &str, rb_obj_class(self));
}