Skip to content

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

instance method

OptionParser::Arguable#options

() -> ::OptionParser
[T] () { (::OptionParser) -> T } -> T?
options() { |optparse| ... }

Actual OptionParser object, automatically created if nonexistent.

If called with a block, yields the OptionParser object and returns the result of the block. If an OptionParser::ParseError exception occurs in the block, it is rescued, a error message printed to STDERR and nil returned.

See also #options= #getopts .extend_object #order! also in 4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0