Class: Sasspectations::OutputFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/sasspectations/output_formatter.rb

Instance Method Summary collapse

Constructor Details

#initialize(parser) ⇒ OutputFormatter

Returns a new instance of OutputFormatter.



5
6
7
8
# File 'lib/sasspectations/output_formatter.rb', line 5

def initialize(parser)
  @parser = parser
  @spec_results = parser.result
end

Instance Method Details

#displayObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/sasspectations/output_formatter.rb', line 10

def display
  puts "Running SCSS Specs:".colorize(:cyan)
  @spec_results.each do |result|
    print result.first
  end
  puts "" # newline
  if @parser.failed?
    puts "Failed Specs:".colorize(:red)

    @spec_results.select { |r| r.first =~ /f/i }.each do |failed_result|
      puts failed_result.last.colorize(:red)
    end
  end
end