def validate!(*acceptable)
    i = 0
    if acceptable.first.is_a?(Hash)
      # clone acceptable hash, swap keys for string
      acceptable = Hash[acceptable.first]
      acceptable.keys.each { |k|
        acceptable[k.to_s] = acceptable[k]
        acceptable.delete(k) unless k.is_a?(String)
      }

      # compare acceptable against arguments, raising error if issue found
      while(i < length) do
        val = self[i]
        passed = acceptable.has_key?(val)
        raise ArgumentError, "#{val} not an acceptable arg" unless passed
        skip = acceptable[val]
        i += (skip + 1)
      end

    else
      # clone acceptable array, swap values for string
      acceptable = Array.new(acceptable).map { |a| a.to_s }

      # compare acceptable against arguments, raising error if issue found
      while(i < length) do
        val = self[i].to_s
        passed = acceptable.include?(val)
        raise ArgumentError, "#{val} not an acceptable arg" unless passed
        i += 1
      end
    end

    nil
  end
def validate!(*acceptable)
    i = 0
    if acceptable.first.is_a?(Hash)
      # clone acceptable hash, swap keys for string
      acceptable = Hash[acceptable.first]
      acceptable.keys.each { |k|
        acceptable[k.to_s] = acceptable[k]
        acceptable.delete(k) unless k.is_a?(String)
      }

      # compare acceptable against arguments, raising error if issue found
      while(i < length) do
        val = self[i]
        passed = acceptable.has_key?(val)
        raise ArgumentError, "#{val} not an acceptable arg" unless passed
        skip = acceptable[val]
        i += (skip + 1)
      end

    else
      # clone acceptable array, swap values for string
      acceptable = Array.new(acceptable).map { |a| a.to_s }

      # compare acceptable against arguments, raising error if issue found
      while(i < length) do
        val = self[i].to_s
        passed = acceptable.include?(val)
        raise ArgumentError, "#{val} not an acceptable arg" unless passed
        i += 1
      end
    end

    nil
  end
Validate arguments against acceptable values.

 Raises error if value is found which is not on
 list of acceptable values.

 If acceptable values are hash's, keys are compared
 and on matches the values are used as the # of following
 arguments to skip in the validator

 *Note* args / acceptable params are converted to strings
 before comparison

 @example
   args = Arguments.new :args => ['custom', 'another']
   args.validate! 'custom', 'another'  #=> nil
   args.validate! 'something'          #=> ArgumentError

   args = Arguments.new :args => ['with_id', 123, 'another']
   args.validate! :with_id => 1, :another => 0 #=> nil
   args.validate! :with_id => 1                #=> ArgumentError