Method: Argvector#parse

Defined in:
lib/supplemental/facets/argvector.rb

#parseObject

Basic parser partitions the command line into options and operands. Options are converted to a hash and the two parts are returned.

line = "--trace stamp --file=VERSION"
argv = Argvector.new(line)

args, keys = *argv.parse

args #=> ["stamp"]
keys #=> {"trace"=>true, "file"=>"VERSION"}


207
208
209
210
211
212
213
214
215
216
# File 'lib/supplemental/facets/argvector.rb', line 207

def parse
  args = assoc_options(argv) #, *opts_arity)

  opts, opds = args.partition{ |a| Array === a }

  @operands = opds
  @options  = format_options(opts)

  return @operands, @options
end