summaryrefslogtreecommitdiff
path: root/lib/coderay/encoders
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2010-10-15 22:57:48 +0000
committermurphy <murphy@rubychan.de>2010-10-15 22:57:48 +0000
commitbf12a7879244fefa4a56c05166107e9b93333b95 (patch)
tree69f9d12d4b8bb33488004ae5e8de5d3ef908df5d /lib/coderay/encoders
parent531350dee768f384a33a4a3a6b9fc5ddcfbef58e (diff)
downloadcoderay-bf12a7879244fefa4a56c05166107e9b93333b95.tar.gz
Cleanup of debug encoder.
Diffstat (limited to 'lib/coderay/encoders')
-rw-r--r--lib/coderay/encoders/debug.rb22
1 files changed, 10 insertions, 12 deletions
diff --git a/lib/coderay/encoders/debug.rb b/lib/coderay/encoders/debug.rb
index ef76192..08f1309 100644
--- a/lib/coderay/encoders/debug.rb
+++ b/lib/coderay/encoders/debug.rb
@@ -1,6 +1,6 @@
module CodeRay
module Encoders
-
+
# = Debug Encoder
#
# Fast encoder producing simple debug output.
@@ -13,18 +13,16 @@ module Encoders
#
# See also: Scanners::Debug
class Debug < Encoder
-
+
register_for :debug
-
+
FILE_EXTENSION = 'raydebug'
def initialize options = {}
super
@opened = []
end
-
- public
-
+
def text_token text, kind
if kind == :space
@out << text
@@ -34,12 +32,12 @@ module Encoders
@out << kind.to_s << '(' << text << ')'
end
end
-
+
def begin_group kind
@opened << kind
@out << kind.to_s << '<'
end
-
+
def end_group kind
if @opened.last != kind
puts @out
@@ -48,16 +46,16 @@ module Encoders
@opened.pop
@out << '>'
end
-
+
def begin_line kind
@out << kind.to_s << '['
end
-
+
def end_line kind
@out << ']'
end
-
+
end
-
+
end
end