method

calculate_directory_statistics

rails latest stable - Class: CodeStatistics
calculate_directory_statistics(directory, pattern = /^(?!\\.).*?\\.(rb|js|ts|css|scss|coffee|rake|erb)$/)
private

No documentation available.

# File railties/lib/rails/code_statistics.rb, line 43
    def calculate_directory_statistics(directory, pattern = /^(?!\.).*?\.(rb|js|ts|css|scss|coffee|rake|erb)$/)
      stats = CodeStatisticsCalculator.new

      Dir.foreach(directory) do |file_name|
        path = "#{directory}/#{file_name}"

        if File.directory?(path) && !file_name.start_with?(".")
          stats.add(calculate_directory_statistics(path, pattern))
        elsif file_name&.match?(pattern)
          stats.add_by_file_path(path)
        end
      end

      stats
    end

1Note

Statistics

WilliamsGeorge ยท Oct 2, 2013

Thanks for the coding part it was really helpful for me, I would apply it on my project. http://www.koolchart.com