Ruby's mode of operation can be altered with some --enable-* / --disable-* command-line switches.
By default, all of the following features are activated, except for the frozen strings and the JIT:
| Feature | CLI Option to Change | Description |
|---|---|---|
| RubyGems | --disable-gems |
RubyGems is the package manager of Ruby, which is required to load 3rd party Ruby libraries¹. |
| RUBYOPT | --disable-rubyopt |
The RUBYOPT ENV variable lets you define default CLI options for Ruby. This switch tells Ruby to ignore RUBYOPT. |
| DidYouMean | --disable-did-you-mean² |
Improves error messages by suggesting auto-corrected method or module names |
| Frozen strings | --enable-frozen-string-literal³ |
Freezes all string literals everywhere. |
| Just-in-time compiler | --enable-jit |
Shortcut to enable is just --jit. New compiler architecture, introduced with Ruby 2.6. See @k0kubun's blog for more details. |
| All of the above | --disable-all / --enable-all |
- |
¹ --disable-gems will also prevent did_you_mean from loading, because it is a standard gem
² Variants: --disable-did_you_mean, --disable-did-you_, --disable-did, --disable-d …
³ Variants: --enable-frozen_string_literal, --enable-frozen_str, --enable-frozen, …
Also See
More Idiosyncratic Ruby
- Please Comment on GitHub
- Next Article: Clear Case of Unclear Casing
- Previous Article: Nothing to Escape
