title: What exactly is gsub in Ruby?
body: <p>I'm still learning Ruby and I'm practicing my <code>get</code> routes and <code>post</code> requests, User sign in, log in, etc for a basic website and I came across a &quot;slug&quot; method:</p>
  <pre><code>def slug
      self.username.strip.downcase.gsub(&quot; &quot;,&quot;-&quot;)
    end
  </code></pre>
  <p>I tried using irb to try and figure out what gsub is doing:</p>
  <pre><code>&quot;hello&quot;.gsub(&quot; &quot;,&quot;-&quot;)
  </code></pre>
  <p>but it just gave me:</p>
  <pre><code>&quot;hello&quot;
  </code></pre>
  <p>And I tried using it on a array, but that didn't work as well.</p>
  <p>But my question is what exactly is gsub doing here? What is gsub in general? What is the outcome of this method?</p>
  <p>Thanks in advance!</p>