Exception: RakeCommander::Options::Error::UnknownArgument

Inherits:
Base show all
Defined in:
lib/rake-commander/options/error/unknown_argument.rb

Overview

Relates to OptionParser#parse output (leftovers)

Constant Summary

Constants inherited from Base

Base::OPTION_REGEX

Constants included from Name

Name::BOOLEAN_NAME_REGEX, Name::BOOLEAN_TOKEN, Name::DOUBLE_HYPHEN_REGEX, Name::HYPEN_REGEX, Name::HYPHEN_START_REGEX, Name::OPTIONAL_REGEX, Name::SINGLE_HYPHEN_REGEX, Name::UNDERSCORE_REGEX, Name::WORD_DELIMITER

Instance Attribute Summary

Attributes inherited from Base

#from, #option

Instance Method Summary collapse

Methods inherited from Base

#from_desc, #name?, option_regex, option_sym, #option_sym, #options, require_argument!, #short?

Methods included from Name

#argument_optional?, #argument_required?, #boolean_name?, #capture_argument_with!, #capture_arguments_name!, #capture_arguments_short!, #double_hyphen?, #name_argument, #name_argument?, #name_hyphen, #name_sym, #name_word_sym, #short_hyphen, #short_sym, #single_hyphen?, #valid_name?, #valid_short?

Methods inherited from Base::CustomError

#message, #to_s

Constructor Details

#initialize(value = nil, from: nil) ⇒ UnknownArgument

Returns a new instance of UnknownArgument.



6
7
8
# File 'lib/rake-commander/options/error/unknown_argument.rb', line 6

def initialize(value = nil, from: nil)
  super("unknown arguments: #{to_message(value)}", from: from)
end

Instance Method Details

#leftoversObject



10
11
12
13
14
15
16
17
# File 'lib/rake-commander/options/error/unknown_argument.rb', line 10

def leftovers
  case @value
  when Array
    @value
  else
    []
  end
end