Class: Cliqr::Parser::SingleValuedOptionToken Private

Inherits:
OptionToken show all
Defined in:
lib/cliqr/parser/single_valued_option_token.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.

Token handler for parsing a option and its value

Instance Attribute Summary

Attributes inherited from OptionToken

#name, #value

Attributes inherited from Token

#arg

Instance Method Summary collapse

Methods inherited from OptionToken

#build, #collect, #valid?

Methods inherited from Token

#active?, #collect

Constructor Details

#initialize(name, arg) ⇒ SingleValuedOptionToken

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.

Create a new option token. Initial state will be active



12
13
14
15
# File 'lib/cliqr/parser/single_valued_option_token.rb', line 12

def initialize(name, arg)
  super(name, arg)
  activate
end

Instance Method Details

#append(arg) ⇒ Cliqr::Parser::SingleValuedOptionToken

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.

Append the next argument in the series and set token to inactive

Parameters:

  • arg (String)

    Argument value of the next command line parameter

Returns:



22
23
24
25
26
# File 'lib/cliqr/parser/single_valued_option_token.rb', line 22

def append(arg)
  @value = arg
  deactivate
  self
end