Class: Saikuro::TokenCounterFormater

Inherits:
BaseFormater show all
Defined in:
lib/saikuro/token_counter_formater.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 Saikuro::BaseFormater

Instance Method Details

#endObject



32
33
# File 'lib/saikuro/token_counter_formater.rb', line 32

def end
end

#end_countObject



29
30
# File 'lib/saikuro/token_counter_formater.rb', line 29

def end_count
end

#end_fileObject



25
26
27
# File 'lib/saikuro/token_counter_formater.rb', line 25

def end_file
  @out.puts ""
end

#line_token_count(line_number, number_of_tokens) ⇒ Object



19
20
21
22
23
# File 'lib/saikuro/token_counter_formater.rb', line 19

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



4
5
6
7
8
# File 'lib/saikuro/token_counter_formater.rb', line 4

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

#start_count(number_of_files) ⇒ Object



10
11
12
# File 'lib/saikuro/token_counter_formater.rb', line 10

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

#start_file(file_name) ⇒ Object



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

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