Sha256: 24f461c864fe52b8e2c46b12104a84e83a9bc407674d9f19710180247fd93b84
Contents?: true
Size: 736 Bytes
Versions: 57
Compression:
Stored size: 736 Bytes
Contents
# encoding: utf-8 module Mongoid #:nodoc: module Matchers #:nodoc: # Checks that all values match. class All < Default # Return true if the attribute and first value in the hash are equal. # # @example Do the values match? # matcher.matches?({ :key => 10 }) # # @param [ Hash ] value The values to check. # # @return [ true, false ] If the values match. def matches?(value) attribute_array = Array.wrap(@attribute) value.values.first.all? do |e| if e.is_a?(Regexp) attribute_array.any? { |_attribute| _attribute =~ e } else attribute_array.include?(e) end end end end end end
Version data entries
57 entries across 57 versions & 3 rubygems