def resolve_under_paths(paths, logical_name, accepts)
        deps = Set.new
        return nil, nil, deps if accepts.empty?

        # TODO: Allow new path resolves to be registered
        @resolvers ||= [
          method(:resolve_main_under_path),
          method(:resolve_alts_under_path),
          method(:resolve_index_under_path)
        ]
        mime_exts = config[:mime_exts]

        paths.each do |load_path|
          candidates = []
          @resolvers.each do |fn|
            result = fn.call(load_path, logical_name, mime_exts)
            candidates.concat(result[0])
            deps.merge(result[1])
          end

          candidate = HTTPUtils.find_best_q_match(accepts, candidates) do |c, matcher|
            match_mime_type?(c[:type] || "application/octet-stream", matcher)
          end
          return candidate[:filename], candidate[:type], deps, candidate[:index_alias] if candidate
        end

        return nil, nil, deps
      end
def resolve_under_paths(paths, logical_name, accepts)
        deps = Set.new
        return nil, nil, deps if accepts.empty?

        # TODO: Allow new path resolves to be registered
        @resolvers ||= [
          method(:resolve_main_under_path),
          method(:resolve_alts_under_path),
          method(:resolve_index_under_path)
        ]
        mime_exts = config[:mime_exts]

        paths.each do |load_path|
          candidates = []
          @resolvers.each do |fn|
            result = fn.call(load_path, logical_name, mime_exts)
            candidates.concat(result[0])
            deps.merge(result[1])
          end

          candidate = HTTPUtils.find_best_q_match(accepts, candidates) do |c, matcher|
            match_mime_type?(c[:type] || "application/octet-stream", matcher)
          end
          return candidate[:filename], candidate[:type], deps, candidate[:index_alias] if candidate
        end

        return nil, nil, deps
      end
Internal: Finds a file in a set of given paths

 paths        - Array of Strings.
 logical_name - String. A filename without extension
                e.g. "application" or "coffee/foo"
 accepts      - Array of array containing mime/version pairs
                e.g. [["application/javascript", 1.0]]

 Finds a file with the same name as `logical_name` or "index" inside
 of the `logical_name` directory that matches a valid mime-type/version from
 `accepts`.

 Returns Array. Filename, type, dependencies, and index_alias