class Rails::TestUnit::CompositeFilter

:nodoc:

def ===(method)

minitest uses === to find matching filters.
def ===(method)
  @filters.any? { |filter| filter === method }
end

def derive_line_filters(patterns)

def derive_line_filters(patterns)
  patterns.flat_map do |file, lines|
    if lines.empty?
      Filter.new(@runnable, file, nil) if file
    else
      lines.map { |line| Filter.new(@runnable, file, line) }
    end
  end
end

def derive_named_filter(filter)

def derive_named_filter(filter)
  if filter.respond_to?(:named_filter)
    filter.named_filter
  elsif filter =~ %r%/(.*)/% # Regexp filtering copied from minitest.
    Regexp.new $1
  elsif filter.is_a?(String)
    filter
  end
end

def initialize(runnable, filter, patterns)

def initialize(runnable, filter, patterns)
  @runnable = runnable
  @named_filter = derive_named_filter(filter)
  @filters = [ @named_filter, *derive_line_filters(patterns) ].compact
end