class RSpec::Core::Metadata
def apply_condition(key, value, metadata=self)
def apply_condition(key, value, metadata=self) case value when Hash value.all? { |k, v| apply_condition(k, v, metadata[key]) } 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 when Fixnum if key == :line_number relevant_line_numbers(metadata).include?(world.preceding_declaration_line(value)) else metadata[key] == value end else metadata[key] == value end end