When a file has the pragma:
# frozen_string_literal: true
all strings written as literals in that file are frozen by default. When I want my strings to be immutable overall, and hence am using the pragma, but want to have a couple of mutable strings, what is the recommended way to write them?
All I can think of is:
String.new("foo")
duptoo. It's just that this is the cool new stuff and the community doesn't have a convention on it yet."foo"uif that is what you are asking. You can't get more concise thanObject#dup. As for performance, I would be surprised ifString.newis significantly better.