End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
OptionParser#environment
environment(env = File.basename($0, '.*'))
lib/optparse.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/lib/optparse.rb, line 1907
def environment(env = File.basename($0, '.*'))
env = ENV[env] || ENV[env.upcase] or return
require 'shellwords'
parse(*Shellwords.shellwords(env))
end
Parses environment variable env or its uppercase with splitting like a shell.
env defaults to the basename of the program.