lib/picky/query/indexes_check.rb in picky-3.6.16 vs lib/picky/query/indexes_check.rb in picky-4.0.0pre1

- old
+ new

@@ -1,45 +1,43 @@ module Picky module Query - # TODO Remove. - # class IndexesCheck class << self # Returns the right combinations strategy for # a number of query indexes. # # Currently it isn't possible using Memory and Redis etc. # indexes in the same query index group. # - # Picky will raise a Query::Indexes::DifferentTypesError. + # Picky will raise a Query::Indexes::DifferentBackendsError. # - def check_backend_types index_definitions_ary # :nodoc: - backend_types = index_definitions_ary.map(&:backend).map(&:class) - backend_types.uniq! - raise_different backend_types if backend_types.size > 1 - backend_types + def check_backends indexes # :nodoc: + backends = indexes.map &:backend + backends.uniq! &:class + raise_different backends if backends.size > 1 + backends end - def raise_different backend_types # :nodoc: - raise DifferentTypesError.new(backend_types) + def raise_different backends # :nodoc: + raise DifferentBackendsError.new(backends) end end end # Currently it isn't possible using Memory and Redis etc. # indexes in the same query index group. # - class DifferentTypesError < StandardError # :nodoc:all - def initialize types - @types = types + class DifferentBackendsError < StandardError # :nodoc:all + def initialize backends + @backends = backends end def to_s - "Currently it isn't possible to mix Indexes with backends #{@types.join(" and ")} in the same Search instance." + "Currently it isn't possible to mix Indexes with backends #{@backends.join(" and ")} in the same Search instance." end end end \ No newline at end of file