# File lib/rspec/core/metadata.rb, line 171
      def filter_applies?(key, value, metadata=self)
        return metadata.filter_applies_to_any_value?(key, value) if Array === metadata[key] && !(Proc === value)
        return metadata.line_number_filter_applies?(value)       if key == :line_numbers
        return metadata.location_filter_applies?(value)          if key == :locations
        return metadata.filters_apply?(key, value)               if Hash === value

        case value
        when Regexp
          metadata[key] =~ value
        when Proc
          if value.arity == 2
            # Pass the metadata hash to allow the proc to check if it even has the key.
            # This is necessary for the implicit :if exclusion filter:
            #   {            } # => run the example
            #   { :if => nil } # => exclude the example
            # The value of metadata[:if] is the same in these two cases but
            # they need to be treated differently.
            value.call(metadata[key], metadata) rescue false
          else
            value.call(metadata[key]) rescue false
          end
        else
          metadata[key].to_s == value.to_s
        end
      end