lib/coderay/encoders/statistic.rb in coderay-1.0.0.800pre vs lib/coderay/encoders/statistic.rb in coderay-1.0.0.815pre

- old
+ new

@@ -13,19 +13,16 @@ TypeStats = Struct.new :count, :size # :nodoc: protected def setup options + super + @type_stats = Hash.new { |h, k| h[k] = TypeStats.new 0, 0 } @real_token_count = 0 end - def generate tokens, options - @tokens = tokens - super - end - STATS = <<-STATS # :nodoc: Code Statistics Tokens %8d @@ -49,14 +46,16 @@ stat.size /= stat.count.to_f end types_stats = @type_stats.sort_by { |k, v| [-v.count, k.to_s] }.map do |k, v| TOKEN_TYPES_ROW % [k, v.count, 100.0 * v.count / all_count, v.size] end.join - STATS % [ + @out << STATS % [ all_count, @real_token_count, all_size, @type_stats.delete_if { |k, v| k.is_a? String }.size, types_stats ] + + super end public def text_token text, kind