Method: Kernel#gsub

Defined in:
ruby.c

#gsub(pattern, replacement) ⇒ String #gsub(pattern) {|...| ... } ⇒ String

Equivalent to $_.gsub..., except that $_ receives the modified result. Available only when -p/-n command line option specified.

Overloads:

  • #gsub(pattern, replacement) ⇒ String

    Returns:

  • #gsub(pattern) {|...| ... } ⇒ String

    Yields:

    • (...)

    Returns:



# File 'ruby.c'

static VALUE
rb_f_gsub(argc, argv)
    int argc;
    VALUE *argv;
{
    VALUE str = rb_funcall3(uscore_get(), rb_intern("gsub"), argc, argv);
    rb_lastline_set(str);
    return str;
}