def compare_params(params, valid_params)
        raise ArgumentError, "Expected `params` to be a kind of `Hash`" unless params.kind_of?(Hash)
        raise ArgumentError, "Expected `valid_params` to be a kind of `Array`" unless valid_params.kind_of?(Array)

        # compute options difference
        difference = params.keys - valid_params
        raise Error, "Invalid params: `#{difference.join('`, `')}`" unless difference.empty?
      end
def compare_params(params, valid_params)
        raise ArgumentError, "Expected `params` to be a kind of `Hash`" unless params.kind_of?(Hash)
        raise ArgumentError, "Expected `valid_params` to be a kind of `Array`" unless valid_params.kind_of?(Array)

        # compute options difference
        difference = params.keys - valid_params
        raise Error, "Invalid params: `#{difference.join('`, `')}`" unless difference.empty?
      end
Checks whether user given +params+ are valid against a defined collection of +valid_params+.

 === Examples

   params = {:foo => 1, :bar => 2}

   compare_params(params, [:foo, :bar])
   # => valid

   compare_params(params, [:foo, :bar, :baz])
   # => raises

   compare_params(params, [:foo])
   # => raises

 Raises::  WWW::Delicious::Error