Class: Cri::Command::OptionParserPartitioningDelegate Private

Inherits:
Object
  • Object
show all
Defined in:
lib/cri/command.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Delegate used for partitioning the list of arguments and options. This delegate will stop the parser as soon as the first argument, i.e. the command, is found.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#last_argumentString (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the last parsed argument, which, in this case, will be the first argument, which will be either nil or the command name.

Returns:

  • (String)

    The last parsed argument.



20
21
22
# File 'lib/cri/command.rb', line 20

def last_argument
  @last_argument
end

Instance Method Details

#argument_added(argument, option_parser) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Called when an argument is parsed.

Parameters:



41
42
43
44
# File 'lib/cri/command.rb', line 41

def argument_added(argument, option_parser)
  @last_argument = argument
  option_parser.stop
end

#option_added(key, value, option_parser) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Called when an option is parsed.

Parameters:

  • key (Symbol)

    The option key (derived from the long format)

  • value

    The option value

  • option_parser (Cri::OptionParser)

    The option parser



31
32
# File 'lib/cri/command.rb', line 31

def option_added(key, value, option_parser)
end