Class: Saikuro::HTMLTokenCounterFormater

Inherits:
TokenCounterFormater show all
Includes:
HTMLStyleSheet
Defined in:
lib/saikuro/html_token_counter_formater.rb

Instance Attribute Summary

Attributes inherited from BaseFormater

#current, #errors, #warnings

Instance Method Summary collapse

Methods included from HTMLStyleSheet

style_sheet, #style_sheet

Methods inherited from BaseFormater

#initialize, #reset_data, #warn_error?

Constructor Details

This class inherits a constructor from Saikuro::BaseFormater

Instance Method Details

#endObject



42
43
44
45
# File 'lib/saikuro/html_token_counter_formater.rb', line 42

def end
  @out.puts "</body>"
  @out.puts "</html>"
end

#end_countObject



39
40
# File 'lib/saikuro/html_token_counter_formater.rb', line 39

def end_count
end

#end_fileObject



35
36
37
# File 'lib/saikuro/html_token_counter_formater.rb', line 35

def end_file
  @out.puts "</table>"
end

#line_token_count(line_number, number_of_tokens) ⇒ Object



29
30
31
32
33
# File 'lib/saikuro/html_token_counter_formater.rb', line 29

def line_token_count(line_number,number_of_tokens)
  return if @filter.ignore?(number_of_tokens)
  klass = warn_error?(number_of_tokens, line_number)
  @out.puts "<tr><td>#{line_number}</td><td#{klass}>#{number_of_tokens}</td></tr>"
end

#start(new_out = nil) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/saikuro/html_token_counter_formater.rb', line 5

def start(new_out=nil)
  reset_data
  @out = new_out if new_out
  @out.puts "<html>"
  @out.puts style_sheet
  @out.puts "<body>"
end

#start_count(number_of_files) ⇒ Object



13
14
15
16
17
# File 'lib/saikuro/html_token_counter_formater.rb', line 13

def start_count(number_of_files)
  @out.puts "<div class=\"start_token_count\">"
  @out.puts "Number of files: #{number_of_files}"
  @out.puts "</div>"
end

#start_file(file_name) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/saikuro/html_token_counter_formater.rb', line 19

def start_file(file_name)
  @current = file_name
  @out.puts "<div class=\"file_count\">"
  @out.puts "<p class=\"file_name\">"
  @out.puts "File: #{file_name}"
  @out.puts "</p>"
  @out.puts "<table width=\"100%\" border=\"1\">"
  @out.puts "<tr><th>Line</th><th>Tokens</th></tr>"
end