Reputation: 1135
I am building a greenfield Rails application on top of Ruby 2.3, and I would like all Rails commands (e.g. rails s
, rails c
) and all Ruby commands (e.g. rake do:something
) to use the new immutable-String functionality introduced in Ruby 2.3. (See, e.g. https://wyeworks.com/blog/2015/12/1/immutable-strings-in-ruby-2-dot-3/)
So, how do I pass that lovely --enable-frozen-string-literal
Ruby option down to Ruby in all possible contexts where some command I issue bottoms out in Ruby?
Thanks in advance!
Upvotes: 16
Views: 5629
Reputation: 296
As far as I know, best way to do it is setting environment variable like followings:
export RUBYOPT=--enable-frozen-string-literal
or
setenv RUBYOPT --enable-frozen-string-literal
However, don't try it right now. It simply doesn't work because some codes in Bundler gem are attempting to modify frozen String. Wait until they fix the problem.
Upvotes: 24