testmycode/tmc-server

View on GitHub
lib/tmc_dir_utils.rb

Summary

Maintainability
A
45 mins
Test Coverage
# frozen_string_literal: true

require 'pathname'
require 'find'

module TmcDirUtils
  extend TmcDirUtils

  def find_dir_containing(root, to_find)
    Pathname(root).find do |path|
      next unless path.directory?
      next unless (path + to_find).directory?
      return path
    end
    nil
  end
end