Class: TokenCounterFormater

Inherits:
BaseFormater show all
Defined in:
lib/saikuro/token_counter_formatter.rb

Direct Known Subclasses

HTMLTokenCounterFormater

Instance Attribute Summary

Attributes inherited from BaseFormater

#current, #errors, #warnings

Instance Method Summary collapse

Methods inherited from BaseFormater

#initialize, #reset_data, #warn_error?

Constructor Details

This class inherits a constructor from BaseFormater

Instance Method Details

#endObject



31
32
# File 'lib/saikuro/token_counter_formatter.rb', line 31

def end
end

#end_countObject



28
29
# File 'lib/saikuro/token_counter_formatter.rb', line 28

def end_count
end

#end_fileObject



24
25
26
# File 'lib/saikuro/token_counter_formatter.rb', line 24

def end_file
  @out.puts ""
end

#line_token_count(line_number, number_of_tokens) ⇒ Object



18
19
20
21
22
# File 'lib/saikuro/token_counter_formatter.rb', line 18

def line_token_count(line_number,number_of_tokens)
  return if @filter.ignore?(number_of_tokens)
  warn_error?(number_of_tokens, line_number)
  @out.puts "Line:#{line_number} ; Tokens : #{number_of_tokens}"
end

#start(new_out = nil) ⇒ Object



3
4
5
6
7
# File 'lib/saikuro/token_counter_formatter.rb', line 3

def start(new_out=nil)
  reset_data
  @out = new_out if new_out
  @out.puts "Token Count"
end

#start_count(number_of_files) ⇒ Object



9
10
11
# File 'lib/saikuro/token_counter_formatter.rb', line 9

def start_count(number_of_files)
  @out.puts "Counting tokens for #{number_of_files} files."
end

#start_file(file_name) ⇒ Object



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

def start_file(file_name)
  @current = file_name
  @out.puts "File:#{file_name}"
end