Class: Audiothority::Summary

Inherits:
Object
  • Object
show all
Defined in:
lib/audiothority/summary.rb

Direct Known Subclasses

PathsOnlySummary

Instance Method Summary collapse

Constructor Details

#initialize(state) ⇒ Summary

Returns a new instance of Summary.



5
6
7
# File 'lib/audiothority/summary.rb', line 5

def initialize(state)
  @state = state
end

Instance Method Details

#display(console) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/audiothority/summary.rb', line 9

def display(console)
  if @state.any?
    @state.each do |path, violations|
      console.say %(#{path} is inconsistent due to:)
      violations.each do |violation|
        checkmark = console.set_color(%(), :red, :bold)
        console.say(checkmark + violation.message)
      end
    end
  else
    checkmark = console.set_color(%(), :green, :bold)
    console.say(checkmark + %(All is good))
  end
end