Sha256: 8db2fdf50b7bef235346a1eace259ae514439668e426f0cbb94b4a345164a1df

Contents?: true

Size: 467 Bytes

Versions: 5

Compression:

Stored size: 467 Bytes

Contents

module PoolParty
  class Optioner
    # Parse the command line options for options without a switch
    def self.parse(argv, safe=[])
      args = []
      # Default options
      safe.push "-v"
      safe.push "-i"
      
      argv.each_with_index do |arg,i|
        unless arg.index("-") == 0# && !arg.match(/(?:[^"']+)/)
          args << arg
        else          
          argv.shift unless safe.include?(arg)
        end
      end
      args
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
auser-poolparty-0.0.9 lib/poolparty/optioner.rb
auser-poolparty-0.1.0 lib/poolparty/optioner.rb
auser-poolparty-0.1.1 lib/poolparty/optioner.rb
auser-poolparty-0.1.2 lib/poolparty/optioner.rb
jtzemp-poolparty-0.1.2 lib/poolparty/optioner.rb