def search(attributes)
      raise Lupa::SearchAttributesError, "Your search params needs to be a hash." unless attributes.respond_to?(:keys)

      set_search_attributes(attributes)
      set_scope_class
      check_method_definitions
      self
    end
def search(attributes)
      raise Lupa::SearchAttributesError, "Your search params needs to be a hash." unless attributes.respond_to?(:keys)

      set_search_attributes(attributes)
      set_scope_class
      check_method_definitions
      self
    end
Public: Set and checks search attributes, and instantiates the Scope class.

 === Options

 <tt>attributes</tt> - The hash containing the search attributes.

 * If attributes is not a Hash kind of class, it will raise a
   Lupa::SearchAttributesError.
 * If attributes keys don't match methods
   defined on your class, it will raise a Lupa::NotImplementedError.

 === Examples

   class ProductSearch < Lupa::Search

     class Scope

       def category
         scope.where(category: search_attributes[:category])
       end

     end

   end

   scope  = Product.where(price: 20..30)
   search = ProductSearch.new(scope).search({ category: 'furniture' })
   # => #<ProductSearch:0x007f7f74070850 @scope=scope, @search_attributes={:category=>'furniture'}, @scope_class=#<ProductSearch::Scope:0x007fd2811001e8 @scope=[1, 2, 3, 4, 5, 6, 7, 8], @search_attributes={:even_numbers=>true}>>

 Returns the class instance itself.