Class: Aspera::Cli::Argument

Inherits:
Object
  • Object
show all
Defined in:
lib/aspera/cli/command_line.rb

Overview

Positional (non-option) command line token.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Argument

Returns a new instance of Argument.



19
20
21
22
23
# File 'lib/aspera/cli/command_line.rb', line 19

def initialize(value)
  @value = value
  @owner = nil
  @consumed = false
end

Instance Attribute Details

#consumed ⇒ Boolean

Returns true once used, as positional argument or as option value.

Returns:

  • (Boolean) —

    true once used, as positional argument or as option value



17
18
19
# File 'lib/aspera/cli/command_line.rb', line 17

def consumed
  @consumed
end

#owner ⇒ Option?

Returns option token claiming this token as its value (--opt value form).

Returns:

  • (Option, nil) —

    option token claiming this token as its value (--opt value form)



15
16
17
# File 'lib/aspera/cli/command_line.rb', line 15

def owner
  @owner
end

#value ⇒ String (readonly)

Returns the raw argument value.

Returns:

  • (String) —

    the raw argument value



13
14
15
# File 'lib/aspera/cli/command_line.rb', line 13

def value
  @value
end

Instance Method Details

#positional? ⇒ Boolean

Returns true if available as positional argument.

Returns:

  • (Boolean) —

    true if available as positional argument



26
# File 'lib/aspera/cli/command_line.rb', line 26

def positional? = !@consumed && @owner.nil?

#to_s ⇒ String

Returns raw argument value.

Returns:

  • (String) —

    raw argument value



29
# File 'lib/aspera/cli/command_line.rb', line 29

def to_s = @value