summaryrefslogtreecommitdiff
path: root/lib/coderay/encoders/debug.rb
diff options
context:
space:
mode:
authorKornelius Kalnbach <murphy@rubychan.de>2016-02-13 00:20:02 +0100
committerKornelius Kalnbach <murphy@rubychan.de>2016-02-13 00:20:02 +0100
commit7dcbf8a62e36c34d94528db7444419de46205a0a (patch)
tree20bab96cf6a857bb951d8cece444b829552ae14b /lib/coderay/encoders/debug.rb
parent463ffa1d43e12169c502bbf8455dc07f93ae45e4 (diff)
downloadcoderay-7dcbf8a62e36c34d94528db7444419de46205a0a.tar.gz
Debug encoder should count tokens for better inspection
Diffstat (limited to 'lib/coderay/encoders/debug.rb')
-rw-r--r--lib/coderay/encoders/debug.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/coderay/encoders/debug.rb b/lib/coderay/encoders/debug.rb
index f4db330..6b680fc 100644
--- a/lib/coderay/encoders/debug.rb
+++ b/lib/coderay/encoders/debug.rb
@@ -15,9 +15,12 @@ module Encoders
register_for :debug
+ attr_reader :size
+
FILE_EXTENSION = 'raydebug'
def text_token text, kind
+ @size += 1
if kind == :space
@out << text
else
@@ -43,6 +46,13 @@ module Encoders
@out << ']'
end
+ protected
+
+ def setup options
+ super
+ @size = 0
+ end
+
end
end