Class ParseError
In: optparse.rb
Parent: RuntimeError

Base class of exceptions from OptionParser.

Methods

inspect   message   new   reason   recover   set_option   to_s  

Constants

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

Attributes

args  [R] 
reason  [W] 

Public Class methods

[Source]

# File optparse.rb, line 1591
    def initialize(*args)
      @args = args
      @reason = nil
    end

Public Instance methods

[Source]

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

Default stringizing method to emit standard error message.

[Source]

# File optparse.rb, line 1630
    def message
      reason + ': ' + args.join(' ')
    end

Returns error reason. Override this for I18N.

[Source]

# File optparse.rb, line 1619
    def reason
      @reason || self.class::Reason
    end

Pushes back erred argument(s) to argv.

[Source]

# File optparse.rb, line 1602
    def recover(argv)
      argv[0, 0] = @args
      argv
    end

[Source]

# File optparse.rb, line 1607
    def set_option(opt, eq)
      if eq
        @args[0] = opt
      else
        @args.unshift(opt)
      end
      self
    end
to_s()

Alias for message

[Validate]

ruby-doc.org is a service of James Britt and Happy Camper Studios, a Ruby application development company in Phoenix, AZ.

Documentation content on ruby-doc.org is provided by remarkable members of the Ruby community.

For more information on the Ruby programming language, visit ruby-lang.org.

Want to help improve Ruby's API docs? See Ruby Documentation Guidelines.