Class: CssClassDuplicates::Printer

Inherits:
Object
  • Object
show all
Defined in:
lib/css_class_duplicates/printer.rb

Overview

This class renders the result in console.

Instance Method Summary collapse

Instance Method Details

#call(entities) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/css_class_duplicates/printer.rb', line 6

def call(entities)
  entities.sort_by { |entity| [-entity.files.size, -entity.classes.size] }.each do |entity|
    puts "#{entity.files.size} matches for \"#{entity.classes.join(' ')}\""
    entity.files.uniq.sort.each do |file_name|
      puts "  #{file_name}"
    end
    puts
  end
end