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.


15
16
17
# File 'lib/cri/command.rb', line 15

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:


35
36
37
38
# File 'lib/cri/command.rb', line 35

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


26
# File 'lib/cri/command.rb', line 26

def option_added(_key, _value, _option_parser); end