Class: Simplabs::Excellent::Formatters::Text

Inherits:
Base
  • Object
show all
Defined in:
lib/simplabs/excellent/formatters/text.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(stream = $stdout) ⇒ Text

Returns a new instance of Text.



11
12
13
14
# File 'lib/simplabs/excellent/formatters/text.rb', line 11

def initialize(stream = $stdout)
  super
  @total_warnings = 0
end

Instance Method Details

#endObject



30
31
32
# File 'lib/simplabs/excellent/formatters/text.rb', line 30

def end
  @stream.puts "\n  Found #{@total_warnings} warnings.\n\n"
end

#file(filename) {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



20
21
22
23
# File 'lib/simplabs/excellent/formatters/text.rb', line 20

def file(filename)
  @stream.puts "\n  #{filename}\n"
  yield self
end

#startObject



16
17
18
# File 'lib/simplabs/excellent/formatters/text.rb', line 16

def start
  @stream.puts "\n  Excellent result:\n"
end

#warning(warning) ⇒ Object



25
26
27
28
# File 'lib/simplabs/excellent/formatters/text.rb', line 25

def warning(warning)
  @stream.puts "    * Line #{warning.line_number.to_s.lpad(3)}: \e[33m#{warning.message}\e[0m"
  @total_warnings += 1
end