Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

OptionParser#environment

(?::String env) -> ::Array[::String]?
environment(env = File.basename($0, '.*'), **keywords)

Parses environment variable env or its uppercase with splitting like a shell.

env defaults to the basename of the program.

See also #def_tail_option #getopts #def_option #help also in 4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0