From: "tagomoris (Satoshi Tagomori) via ruby-core" Date: 2026-09-17T15:12:37+00:00 Subject: [ruby-core:126758] [Ruby Feature#22329] Specify --disable-gem per Ruby Box Issue #22329 has been reported by tagomoris (Satoshi Tagomori). ---------------------------------------- Feature #22329: Specify --disable-gem per Ruby Box https://bugs.ruby-lang.org/issues/22329 * Author: tagomoris (Satoshi Tagomori) * Status: Open * Assignee: tagomoris (Satoshi Tagomori) * Target version: 4.1 ---------------------------------------- Currently user boxes loads gems listed in the gem_prelude.rb if those gems are enabled in the process-wide. There is just only way to disable gems in boxes: specify `--disable-gems` in the entire process. This proposes a new keyword argument on `Ruby::Box#new` to disable gems per box. This makes possible to create a simple, clean boxes if the box doesn't require RubyGems and other bundled gems. Boxes without RubyGems are still useful for loading small scripts, reducing security risks by keeping load_path clean&simple, etc. ``` # RubyGems is enabled in main Gem #=> Gem # Create a box without RubyGems box = Ruby::Box.new(disable_gems: true) box::Gem # NameError ``` The default value of `disable_gems` is `false. There may be two options to have keyword arguments: * have all of `disable_gems`, `error_highlight`, `did_you_mean`, `syntax_suggest` similar to the command line options * have only `disable_gems` to disable all of 4 gems IMO having only `disable_gems` looks enough because all of RubyGems/ErrorHightlight/DidYouMean/SyntaxSuggest bring the better developer experience. The single keyword argument `disable_gems` can explain well: "this box doesn't expect those developer-centric features". Another discussion point is how we should handle `Ruby::Box.new(disable_gems: false)` when the process-wide `--disable-gems` is specified. Options: * respect the process-wide selection and leave RubyGems an others are not loaded * try to load RubyGems and others only in the box I prefer the first option, but it's not a strong opinion. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/