Sha256: c5771a183a2d7270e603536cb7e3c99aadbbdc52c3d9690d3ed116716da3809d

Contents?: true

Size: 803 Bytes

Versions: 9

Compression:

Stored size: 803 Bytes

Contents

module Slop
  # Base error class.
  class Error < StandardError
  end

  # Raised when calling `call` on Slop::Option (this
  # method must be overriden in subclasses)
  class NotImplementedError < Error
  end

  # Raised when an option that expects an argument is
  # executed without one. Suppress with the `suppress_errors`
  # config option.
  class MissingArgument < Error
    attr_reader :flags

    # Get all the flags that matches
    # the option with the missing argument
    def initialize(msg, flags)
      super(msg)
      @flags = flags
    end
  end

  # Raised when an unknown option is parsed. Suppress
  # with the `suppress_errors` config option.
  class UnknownOption < Error
    attr_reader :flag

    def initialize(msg, flag)
      super(msg)
      @flag = flag
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
slop-4.5.0 lib/slop/error.rb
slop-4.4.3 lib/slop/error.rb
slop-4.4.2 lib/slop/error.rb
slop-4.4.1 lib/slop/error.rb
slop-4.4.0 lib/slop/error.rb
slop-4.3.0 lib/slop/error.rb
slop-4.2.1 lib/slop/error.rb
slop-4.2.0 lib/slop/error.rb
slop-4.1.0 lib/slop/error.rb