The NEWS file defines what the pragma actually is,[1], but you&#x27;d use it like so:<p><pre><code>    # frozen_string_literal: true
    str = &#x27;foo&#x27;
    str &lt;&lt; &#x27;bar&#x27;
</code></pre>
This will now produce an error:<p><pre><code>    # main.rb:3:in `&lt;main&gt;&#x27;: can&#x27;t modify frozen String (RuntimeError)
</code></pre>
It&#x27;s equivalent to Ruby 2.1&#x27;s String#freeze:[2]<p><pre><code>    str = &#x27;foo&#x27;.freeze
    str &lt;&lt; &#x27;bar&#x27;

    # main.rb:2:in `&lt;main&gt;&#x27;: can&#x27;t modify frozen String (RuntimeError)
</code></pre>
Except that it will affect all strings created after the pragma mark.<p>You can also trigger this behavior globally with the --enable=frozen-string-literal option.<p>[1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;ruby&#x2F;ruby&#x2F;blob&#x2F;v2_3_0&#x2F;NEWS#L17-L26" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ruby&#x2F;ruby&#x2F;blob&#x2F;v2_3_0&#x2F;NEWS#L17-L26</a><p>[2]: <a href="http:&#x2F;&#x2F;ruby-doc.org&#x2F;core-2.2.3&#x2F;Object.html#method-i-freeze" rel="nofollow">http:&#x2F;&#x2F;ruby-doc.org&#x2F;core-2.2.3&#x2F;Object.html#method-i-freeze</a>