Sha256: 5e8e613d7d23b3bf68e535a86c39082d60e5097a6e71f75ff20359de980acb2d
Contents?: true
Size: 727 Bytes
Versions: 57
Compression:
Stored size: 727 Bytes
Contents
# encoding: utf-8 module Mongoid #:nodoc: module Matchers #:nodoc: # Performs matching for any value in an array. class In < Default # Return true if the attribute is in the values. # # @example Do the values match? # matcher.matches?({ :key => 10 }) # # @param [ Hash ] value The values to check. # # @return [ true, false ] If a value exists. def matches?(value) attribute_array = Array.wrap(@attribute) value.values.first.any? 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