Class: CommandKit::Arguments::ArgumentValue Private

Inherits:
Object
  • Object
show all
Defined in:
lib/command_kit/arguments/argument_value.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.

Represents an individual argument value.

Direct Known Subclasses

Argument, Options::OptionValue

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(required: true, usage:) ⇒ ArgumentValue

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.

Initializes the argument value.

Parameters:

  • required (Boolean) (defaults to: true)

    Specifies whether the argument value is required or optional.

  • usage (String)

    The usage string to represent the argument value.



31
32
33
34
# File 'lib/command_kit/arguments/argument_value.rb', line 31

def initialize(required: true, usage: )
  @required = required
  @usage    = usage
end

Instance Attribute Details

#requiredBoolean (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.

Specifies whether the argument value is required or optional.

Returns:

  • (Boolean)


15
16
17
# File 'lib/command_kit/arguments/argument_value.rb', line 15

def required
  @required
end

#usageString (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.

The usage string to describe the argument value.

Returns:

  • (String)


20
21
22
# File 'lib/command_kit/arguments/argument_value.rb', line 20

def usage
  @usage
end

Instance Method Details

#optional?Boolean

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.

Determines whether the argument can be omitted.

Returns:

  • (Boolean)


50
51
52
# File 'lib/command_kit/arguments/argument_value.rb', line 50

def optional?
  !@required
end

#required?Boolean

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.

Determines if the argument is required or not.

Returns:

  • (Boolean)


41
42
43
# File 'lib/command_kit/arguments/argument_value.rb', line 41

def required?
  @required
end