Skip to content

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

instance method

OptionParser#order

order(*argv, into: nil, &nonopt)

Parses command line arguments argv in order. When a block is given, each non-option argument is yielded. 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).

Returns the rest of argv left unparsed.

See also #order! #on_tail #on_head #parse also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0