Class: PartialInspector::Reporter

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/partial_inspector/reporter.rb

Instance Method Summary collapse

Instance Method Details

#report_files_rendering_partial(partial_path) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/partial_inspector/reporter.rb', line 7

def report_files_rendering_partial(partial_path)
  files = base_scanner(partial_path)
  return "\e[41m\e[34mINVALID PATH\e[0m\e[0m" if files.empty?

  search_results_count = files.size
  grouped_files = combine_unique_files(files)

  puts "\n\e[36mSEARCH SUMMARY\e[0m"
  puts "\e[35mTOTAL SEARCH RESULTS\e[0m: \e[32m#{search_results_count}\e[0m"
  puts "\e[35mTOTAL FILES\e[0m: \e[32m#{grouped_files.keys.size}\e[0m"

  puts "\n\e[36mDETAILS\e[0m"
  grouped_files.each do |key, value|
    puts "\e[35mFILE NAME\e[0m: \e[34m#{key.to_s}\e[0m"
    file_contents = value
    file_contents.each do |file_content|
      puts "\e[35mLINE #{file_content[:line_number]}\e[0m: #{file_content[:line_content]} "
    end
    puts "RENDERED \e[32m#{file_contents.size} TIME(S)\e[0m\n\n"
  end
  return
end