~ubuntu-branches/ubuntu/vivid/ruby-cri/vivid

« back to all changes in this revision

Viewing changes to lib/cri/argument_array.rb

  • Committer: Package Import Robot
  • Author(s): Cédric Boutillier
  • Date: 2014-04-14 15:15:48 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20140414151548-xni482c106hiik3q
Tags: 2.6.0-1
* Imported Upstream version 2.6.0
* Add asciidoctor to Build-Depends, now that the README file has a .adoc
  extension
* Add privacy-breach.patch to remove remote badges from the README file

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# encoding: utf-8
 
2
 
 
3
module Cri
 
4
 
 
5
  # Represents an array of arguments. It is an array that strips separator
 
6
  # arguments (`--`) but provides a `#raw` method to get the raw arguments
 
7
  # array, i.e. an array that includes the separator `--` arguments.
 
8
  class ArgumentArray < Array
 
9
 
 
10
    # Initializes the array using the given raw arguments.
 
11
    #
 
12
    # @param [Array<String>] raw_arguments A list of raw arguments, i.e.
 
13
    #   including any separator arguments (`--`).
 
14
    def initialize(raw_arguments)
 
15
      super(raw_arguments.reject { |a| '--' == a })
 
16
      @raw_arguments = raw_arguments
 
17
    end
 
18
 
 
19
    # @return [Array<String>] The arguments, including any separator arguments
 
20
    #   (`--`)
 
21
    def raw
 
22
      @raw_arguments
 
23
    end
 
24
 
 
25
  end
 
26
 
 
27
end