Class: Cri::Command::ParserPartitioningDelegate — Documentation by YARD 0.9.34

# Class: Cri::Command::ParserPartitioningDelegate Private

Inherits:
  Object
  - Object
  - Cri::Command::ParserPartitioningDelegate
  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

- #last_argument ⇒ String readonly private

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

## Instance Method Summary collapse

- #argument_added(argument, parser) ⇒ void private

  Called when an argument is parsed.

- #option_added(_key, _value, _parser) ⇒ void private

  Called when an option is parsed.

## Instance Attribute Details

### #last_argument ⇒ `String` (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.

    17
    18
    19
    # File 'lib/cri/command.rb', line 17

    def last_argument
      @last_argument
    end

## Instance Method Details

### #argument_added(argument, 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:

- argument (`String`) —

  The argument

- parser (`Cri::Parser`) —

  The option parser

    37
    38
    39
    40
    # File 'lib/cri/command.rb', line 37

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

### #option_added(_key, _value, _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

- _parser (`Cri::Parser`) —

  The option parser

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

    def option_added(_key, _value, _parser); end