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

GetoptLong#ordering=

ordering=(ordering)

Sets the ordering; see Ordering; returns the new ordering.

If the given ordering is PERMUTE and environment variable POSIXLY_CORRECT is defined, sets the ordering to REQUIRE_ORDER; otherwise sets the ordering to ordering:

Example
options = GetoptLong.new
options.ordering == GetoptLong::PERMUTE # => true
options.ordering = GetoptLong::RETURN_IN_ORDER
options.ordering == GetoptLong::RETURN_IN_ORDER # => true
ENV['POSIXLY_CORRECT'] = 'true'
options.ordering = GetoptLong::PERMUTE
options.ordering == GetoptLong::REQUIRE_ORDER # => true

Raises an exception if ordering is invalid.

See also #get_option #set_error #get #set_options also in 3.3 · 3.1 · 3.0