End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Gem::Command#deprecate_option
deprecate_option(name, version: nil, extra_msg: nil)
lib/rubygems/command.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.1.3/lib/rubygems/command.rb, line 390
def deprecate_option(name, version: nil, extra_msg: nil)
@deprecated_options[command].merge!({ name => { "rg_version_to_expire" => version, "extra_msg" => extra_msg } })
end
Mark a command-line option as deprecated, and optionally specify a deprecation horizon.
Note that with the current implementation, every version of the option needs to be explicitly deprecated, so to deprecate an option defined as
Example
add_option('-t', '--[no-]test', 'Set test mode') do |value, options| # ... stuff ... end
you would need to explicitly add a call to deprecate_option for every version of the option you want to deprecate, like
Example
deprecate_option('-t') deprecate_option('--test') deprecate_option('--no-test')