Sha256: f4a8bbcacaf71ea405d731f74204547feb5b2b9b45ab79430dbc1e50a7f10118

Contents?: true

Size: 725 Bytes

Versions: 4

Compression:

Stored size: 725 Bytes

Contents

module Cri
  # Represents an array of arguments. It is an array that strips separator
  # arguments (`--`) but provides a `#raw` method to get the raw arguments
  # array, i.e. an array that includes the separator `--` arguments.
  class ArgumentArray < Array
    # Initializes the array using the given raw arguments.
    #
    # @param [Array<String>] raw_arguments A list of raw arguments, i.e.
    #   including any separator arguments (`--`).
    def initialize(raw_arguments)
      super(raw_arguments.reject { |a| a == '--' })
      @raw_arguments = raw_arguments
    end

    # @return [Array<String>] The arguments, including any separator arguments
    #   (`--`)
    def raw
      @raw_arguments
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cri-2.10.1 lib/cri/argument_array.rb
cri-2.10.0 lib/cri/argument_array.rb
cri-2.9.1 lib/cri/argument_array.rb
cri-2.9.0 lib/cri/argument_array.rb