Sha256: 0d8f6558bbd02f24f642cb8893b628330e47fd03395d98c1125027207fc1f5d2

Contents?: true

Size: 560 Bytes

Versions: 4

Compression:

Stored size: 560 Bytes

Contents

module Casino
  class Intersection
    module Match
      class All < Equivalence

        def eligible?
          key == '$and'
        end

        def evaluate
          matchers.map(&:evaluate).all?
        end

        private

        def matchers
          field.reduce(Array.new) do |list, element|
            list + build_bases_with_element_keys(element)
          end
        end

        def build_bases_with_element_keys(element)
          element.keys.map { |key| Base.new(document, key, element, value) }
        end

      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mongoid-casino-0.0.4 lib/casino/intersection/match/all.rb
mongoid-casino-0.0.3 lib/casino/intersection/match/all.rb
mongoid-casino-0.0.2 lib/casino/intersection/match/all.rb
mongoid-casino-0.0.1 lib/casino/intersection/match/all.rb