Class: Aspera::Cli::Argument
- Inherits:
-
Object
- Object
- Aspera::Cli::Argument
- Defined in:
- lib/aspera/cli/command_line.rb
Overview
Positional (non-option) command line token.
Instance Attribute Summary collapse
-
#consumed ⇒ Boolean
trueonce used, as positional argument or as option value. -
#owner ⇒ Option?
Option token claiming this token as its value (
--opt valueform). -
#value ⇒ String
readonly
The raw argument value.
Instance Method Summary collapse
-
#initialize(value) ⇒ Argument
constructor
A new instance of Argument.
-
#positional? ⇒ Boolean
trueif available as positional argument. -
#to_s ⇒ String
Raw argument value.
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.
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).
15 16 17 |
# File 'lib/aspera/cli/command_line.rb', line 15 def owner @owner end |
#value ⇒ String (readonly)
Returns 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.
26 |
# File 'lib/aspera/cli/command_line.rb', line 26 def positional? = !@consumed && @owner.nil? |
#to_s ⇒ String
Returns raw argument value.
29 |
# File 'lib/aspera/cli/command_line.rb', line 29 def to_s = @value |