Class: JSLintJohnson::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/jslint-johnson/formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stream) ⇒ Formatter

Returns a new instance of Formatter.



6
7
8
# File 'lib/jslint-johnson/formatter.rb', line 6

def initialize(stream)
  @output_stream = stream
end

Instance Attribute Details

#output_streamObject (readonly)

Returns the value of attribute output_stream.



4
5
6
# File 'lib/jslint-johnson/formatter.rb', line 4

def output_stream
  @output_stream
end

Instance Method Details

#summary(tested_files, lint_result) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/jslint-johnson/formatter.rb', line 15

def summary(tested_files, lint_result)
  if lint_result.keys.any?
    print_error_summary(lint_result)
    output_stream.print "\n"
  end
  
  print_count_summary(tested_files, lint_result)
end

#tick(errors) ⇒ Object



10
11
12
13
# File 'lib/jslint-johnson/formatter.rb', line 10

def tick(errors)
  output_stream.print(errors.any?? "*" : ".")
  output_stream.flush
end