Sha256: 6e62394c4808a23b94a7e6d7a8fa7d556d418d8a17b2340cb528ea4c22d69fcb

Contents?: true

Size: 748 Bytes

Versions: 3

Compression:

Stored size: 748 Bytes

Contents

# encoding: utf-8

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

3 entries across 3 versions & 1 rubygems

Version Path
cri-2.6.1 lib/cri/argument_array.rb
cri-2.6.0 lib/cri/argument_array.rb
cri-2.5.0 lib/cri/argument_array.rb