summaryrefslogtreecommitdiff
path: root/lib/coderay/encoders/statistic.rb
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2010-06-29 07:28:21 +0000
committermurphy <murphy@rubychan.de>2010-06-29 07:28:21 +0000
commitca8991535b81bbcf48ef95d57cd1e9f6e1a5ace0 (patch)
tree3a820e00b31fb1fd81bb717c7cdfc030fa63080c /lib/coderay/encoders/statistic.rb
parent9581711d20251253f3f430e0fe2e49795752b6d5 (diff)
downloadcoderay-ca8991535b81bbcf48ef95d57cd1e9f6e1a5ace0.tar.gz
Made token methods of Statisic encoder public.
Diffstat (limited to 'lib/coderay/encoders/statistic.rb')
-rw-r--r--lib/coderay/encoders/statistic.rb64
1 files changed, 33 insertions, 31 deletions
diff --git a/lib/coderay/encoders/statistic.rb b/lib/coderay/encoders/statistic.rb
index 38464ce..c6ffd7a 100644
--- a/lib/coderay/encoders/statistic.rb
+++ b/lib/coderay/encoders/statistic.rb
@@ -23,37 +23,7 @@ module Encoders
@tokens = tokens
super
end
-
- def text_token text, kind
- @real_token_count += 1 unless kind == :space
- @type_stats[kind].count += 1
- @type_stats[kind].size += text.size
- @type_stats['TOTAL'].size += text.size
- @type_stats['TOTAL'].count += 1
- end
-
- # TODO Hierarchy handling
- def begin_group kind
- block_token 'begin_group'
- end
-
- def end_group kind
- block_token 'end_group'
- end
-
- def begin_line kind
- block_token 'begin_line'
- end
-
- def end_line kind
- block_token 'end_line'
- end
-
- def block_token action
- @type_stats['TOTAL'].count += 1
- @type_stats[action].count += 1
- end
-
+
STATS = <<-STATS # :nodoc:
Code Statistics
@@ -88,6 +58,38 @@ Token Types (%d):
]
end
+ public
+
+ def text_token text, kind
+ @real_token_count += 1 unless kind == :space
+ @type_stats[kind].count += 1
+ @type_stats[kind].size += text.size
+ @type_stats['TOTAL'].size += text.size
+ @type_stats['TOTAL'].count += 1
+ end
+
+ # TODO Hierarchy handling
+ def begin_group kind
+ block_token 'begin_group'
+ end
+
+ def end_group kind
+ block_token 'end_group'
+ end
+
+ def begin_line kind
+ block_token 'begin_line'
+ end
+
+ def end_line kind
+ block_token 'end_line'
+ end
+
+ def block_token action
+ @type_stats['TOTAL'].count += 1
+ @type_stats[action].count += 1
+ end
+
end
end