Class: Csscss::JSONReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/csscss/json_reporter.rb

Instance Method Summary collapse

Constructor Details

#initialize(redundancies) ⇒ JSONReporter

Returns a new instance of JSONReporter.



3
4
5
# File 'lib/csscss/json_reporter.rb', line 3

def initialize(redundancies)
  @redundancies = redundancies
end

Instance Method Details

#reportObject



7
8
9
10
11
12
13
14
15
# File 'lib/csscss/json_reporter.rb', line 7

def report
  JSON.dump(@redundancies.map {|selector_groups, declarations|
    {
      "selectors"    => selector_groups.map(&:to_s),
      "count"        => declarations.count,
      "declarations" => declarations.map(&:to_s)
    }
  })
end