7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/csscss/reporter.rb', line 7
def report(options = {})
verbose = options.fetch(:verbose, false)
should_color = options.fetch(:color, true)
io = StringIO.new
@redundancies.each do |selector_groups, declarations|
selector_groups = selector_groups.map {|selectors| "{#{maybe_color(selectors, :red, should_color)}}" }
last_selector = selector_groups.pop
count = declarations.size
io.puts %Q(#{selector_groups.join(", ")} AND #{last_selector} share #{maybe_color(count, :red, should_color)} rule#{"s" if count > 1})
if verbose
declarations.each {|dec| io.puts(" - #{maybe_color(dec, :yellow, should_color)}") }
end
end
io.rewind
io.read
end
|