Skip to content

End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

OptionParser#parse

parse(*argv, into: nil)

Parses command line arguments argv in order when environment variable POSIXLY_CORRECT is set, and in permutation mode otherwise. When optional into keyword argument is provided, the parsed option values are stored there via []= method (so it can be Hash, or OpenStruct, or other similar object).

See also #parse! #order! #order #permute also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0