Sha256: 760def32856ebcdd6a45804a3f2ba7ea28df98f0054477b3607303c991650102

Contents?: true

Size: 1.08 KB

Versions: 8

Compression:

Stored size: 1.08 KB

Contents

module CommandKit
  module Arguments
    #
    # Represents an individual argument value.
    #
    # @api private
    #
    class ArgumentValue

      # Specifies whether the argument value is required or optional.
      #
      # @return [Boolean]
      attr_reader :required

      # The usage string to describe the argument value.
      #
      # @return [String]
      attr_reader :usage

      #
      # Initializes the argument value.
      #
      # @param [Boolean] required
      #   Specifies whether the argument value is required or optional.
      #
      # @param [String] usage
      #   The usage string to represent the argument value.
      #
      def initialize(required: true, usage: )
        @required = required
        @usage    = usage
      end

      #
      # Determines if the argument is required or not.
      #
      # @return [Boolean]
      #
      def required?
        @required
      end

      #
      # Determines whether the argument can be omitted.
      #
      # @return [Boolean]
      #
      def optional?
        !@required
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
command_kit-0.5.0 lib/command_kit/arguments/argument_value.rb
command_kit-0.4.1 lib/command_kit/arguments/argument_value.rb
command_kit-0.4.0 lib/command_kit/arguments/argument_value.rb
command_kit-0.3.0 lib/command_kit/arguments/argument_value.rb
command_kit-0.2.2 lib/command_kit/arguments/argument_value.rb
command_kit-0.2.1 lib/command_kit/arguments/argument_value.rb
command_kit-0.2.0 lib/command_kit/arguments/argument_value.rb
command_kit-0.1.0 lib/command_kit/arguments/argument_value.rb