Class OptionParser::ParseError
In: lib/optparse.rb
Parent: RuntimeError

Base class of exceptions from OptionParser.

Methods

inspect   message   new   reason   recover   set_option   to_s   to_str  

Constants

Reason = 'parse error'.freeze   Reason which caused the error.

Attributes

args  [R] 
reason  [W] 

Public Class methods

[Source]

      # File lib/optparse.rb, line 1529
1529:     def initialize(*args)
1530:       @args = args
1531:       @reason = nil
1532:     end

Public Instance methods

[Source]

      # File lib/optparse.rb, line 1561
1561:     def inspect
1562:       "#<#{self.class.to_s}: #{args.join(' ')}>"
1563:     end

Default stringizing method to emit standard error message.

[Source]

      # File lib/optparse.rb, line 1568
1568:     def message
1569:       reason + ': ' + args.join(' ')
1570:     end

Returns error reason. Override this for I18N.

[Source]

      # File lib/optparse.rb, line 1557
1557:     def reason
1558:       @reason || self.class::Reason
1559:     end

Pushes back erred argument(s) to argv.

[Source]

      # File lib/optparse.rb, line 1540
1540:     def recover(argv)
1541:       argv[0, 0] = @args
1542:       argv
1543:     end

[Source]

      # File lib/optparse.rb, line 1545
1545:     def set_option(opt, eq)
1546:       if eq
1547:         @args[0] = opt
1548:       else
1549:         @args.unshift(opt)
1550:       end
1551:       self
1552:     end
to_s()

Alias for message

to_str()

Alias for message

[Validate]