class BigFiles::Inspector
Investigate a project and generate a report on the n biggest files
Public Class Methods
new(config: Config.new, source_file_globber: SourceFinder::SourceFileGlobber.new, file_with_lines: FileWithLines, io: Kernel)
click to toggle source
# File lib/bigfiles/inspector.rb, line 10 def initialize(config: Config.new, source_file_globber: SourceFinder::SourceFileGlobber.new, file_with_lines: FileWithLines, io: Kernel) @config = config @source_file_globber = source_file_globber @file_with_lines = file_with_lines @io = io end
Public Instance Methods
find_analyze_and_report_on_files()
click to toggle source
# File lib/bigfiles/inspector.rb, line 29 def find_analyze_and_report_on_files find_and_analyze.each do |file| @io.puts "#{file.num_lines}: #{file.filename}" end end
find_and_analyze()
click to toggle source
# File lib/bigfiles/inspector.rb, line 20 def find_and_analyze @source_file_globber.source_files_glob = @config.glob @source_file_globber.source_files_exclude_glob = @config.exclude file_list = @source_file_globber.source_files_arr file_list.map do |filename| @file_with_lines.new(filename) end.sort.reverse[0..(@config.num_files - 1)] end