def process_args(pos_vals, kw_vals, rest_vals)
            result = {}

            # Process positional arguments
            pos_args = @definition.positional_args
            pos_args.each_with_index do |arg, i|
                break if i >= pos_vals.length
                result[arg.key] = process_arg_val(arg, pos_vals[i], result)
            end
            if pos_vals.size > pos_args.size
                if @definition.rest_args?
                    rest_vals = pos_vals[pos_args.size..-1] + rest_vals
                else
                    self.errors << "#{pos_vals.size} positional #{pos_vals.size == 1 ? 'argument' : 'arguments'} #{
                        pos_vals.size == 1 ? 'was' : 'were'} supplied, but only #{pos_args.size} #{
                        pos_args.size == 1 ? 'is' : 'are'} defined"
                end
            end

            # Process key-word based arguments
            kw_vals.each do |arg, val|
                result[arg.key] = process_arg_val(arg, val, result)
            end

            # Process rest values
            if rest_vals.size > 0
                if rest_arg = @definition.rest_args
                    result[rest_arg.key] = process_arg_val(rest_arg, rest_vals, result)
                else
                    self.errors << "#{rest_vals.size} rest #{rest_vals.size == 1 ? 'value' : 'values'} #{
                        rest_vals.size == 1 ? 'was' : 'were'} supplied, but no rest argument is defined"
                end
            end

            # Default unspecified arguments
            @definition.args.select{ |arg| !result.has_key?(arg.key) }.each do |arg|
                result[arg.key] = process_arg_val(arg, arg.default, result, true)
            end

            # Validate if any set requirements have been satisfied
            self.errors.concat(@definition.validate_requirements(result))
            if self.errors.size > 0
                @show_usage = true
            elsif result.empty?
                EmptyArgs.new
            else
                props = result.keys
                @definition.args.each{ |arg| props << arg.key unless result.has_key?(arg.key) }
                args = Struct.new(*props)
                args.new(*result.values)
            end
        end
def process_args(pos_vals, kw_vals, rest_vals)
            result = {}

            # Process positional arguments
            pos_args = @definition.positional_args
            pos_args.each_with_index do |arg, i|
                break if i >= pos_vals.length
                result[arg.key] = process_arg_val(arg, pos_vals[i], result)
            end
            if pos_vals.size > pos_args.size
                if @definition.rest_args?
                    rest_vals = pos_vals[pos_args.size..-1] + rest_vals
                else
                    self.errors << "#{pos_vals.size} positional #{pos_vals.size == 1 ? 'argument' : 'arguments'} #{
                        pos_vals.size == 1 ? 'was' : 'were'} supplied, but only #{pos_args.size} #{
                        pos_args.size == 1 ? 'is' : 'are'} defined"
                end
            end

            # Process key-word based arguments
            kw_vals.each do |arg, val|
                result[arg.key] = process_arg_val(arg, val, result)
            end

            # Process rest values
            if rest_vals.size > 0
                if rest_arg = @definition.rest_args
                    result[rest_arg.key] = process_arg_val(rest_arg, rest_vals, result)
                else
                    self.errors << "#{rest_vals.size} rest #{rest_vals.size == 1 ? 'value' : 'values'} #{
                        rest_vals.size == 1 ? 'was' : 'were'} supplied, but no rest argument is defined"
                end
            end

            # Default unspecified arguments
            @definition.args.select{ |arg| !result.has_key?(arg.key) }.each do |arg|
                result[arg.key] = process_arg_val(arg, arg.default, result, true)
            end

            # Validate if any set requirements have been satisfied
            self.errors.concat(@definition.validate_requirements(result))
            if self.errors.size > 0
                @show_usage = true
            elsif result.empty?
                EmptyArgs.new
            else
                props = result.keys
                @definition.args.each{ |arg| props << arg.key unless result.has_key?(arg.key) }
                args = Struct.new(*props)
                args.new(*result.values)
            end
        end
Process arguments using the supplied +pos_vals+ Array of positional
 argument values, and the +kw_vals+ Hash of keyword/value.