From 8f8d029f1e9ba286e43cedc274a89bae3fb318b4 Mon Sep 17 00:00:00 2001 From: murphy Date: Tue, 30 Mar 2010 01:13:11 +0000 Subject: Added documentation to encoders; more code cleanups. --- lib/coderay/encoders/statistic.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lib/coderay/encoders/statistic.rb') diff --git a/lib/coderay/encoders/statistic.rb b/lib/coderay/encoders/statistic.rb index 6d0c646..1b38938 100644 --- a/lib/coderay/encoders/statistic.rb +++ b/lib/coderay/encoders/statistic.rb @@ -2,16 +2,18 @@ module CodeRay module Encoders # Makes a statistic for the given tokens. + # + # Alias: +stats+ class Statistic < Encoder include Streamable register_for :stats, :statistic - attr_reader :type_stats, :real_token_count + attr_reader :type_stats, :real_token_count # :nodoc: - protected + TypeStats = Struct.new :count, :size # :nodoc: - TypeStats = Struct.new :count, :size + protected def setup options @type_stats = Hash.new { |h, k| h[k] = TypeStats.new 0, 0 } @@ -37,7 +39,7 @@ module Encoders @type_stats['open/close'].count += 1 end - STATS = <<-STATS + STATS = <<-STATS # :nodoc: Code Statistics @@ -51,7 +53,7 @@ Token Types (%d): %s STATS # space 12007 33.81 % 1.7 - TOKEN_TYPES_ROW = <<-TKR + TOKEN_TYPES_ROW = <<-TKR # :nodoc: %-20s %8d %6.2f %% %5.1f TKR -- cgit v1.2.1