summaryrefslogtreecommitdiff
path: root/lib/coderay/encoder.rb
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2010-06-29 07:00:39 +0000
committermurphy <murphy@rubychan.de>2010-06-29 07:00:39 +0000
commitebab9d3ec5280066e443bfd19b43219dbef9b588 (patch)
tree8ca3c5df8eda66d0fea2fe9886d6070049291136 /lib/coderay/encoder.rb
parent57b35c22e258a8159532f92780f9ccc89a722bbd (diff)
downloadcoderay-ebab9d3ec5280066e443bfd19b43219dbef9b588.tar.gz
Encoder changes: The base class now serves as a complete to_s encoder, concatenating all text tokens together. The Text encoder inherits this. Use Tokens#to_s to use this encoder.
Also fixed an issue with automatically calculated FILE_EXTENSION being a symbol.
Diffstat (limited to 'lib/coderay/encoder.rb')
-rw-r--r--lib/coderay/encoder.rb5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/coderay/encoder.rb b/lib/coderay/encoder.rb
index 7acfe79..6515156 100644
--- a/lib/coderay/encoder.rb
+++ b/lib/coderay/encoder.rb
@@ -33,7 +33,7 @@ module CodeRay
# downcase class name instead.
def const_missing sym
if sym == :FILE_EXTENSION
- plugin_id
+ plugin_id.to_s
else
super
end
@@ -59,8 +59,6 @@ module CodeRay
# added to the options you passed at creation.
def initialize options = {}
@options = self.class::DEFAULT_OPTIONS.merge options
- raise "I am only the basic Encoder class. I can't encode "\
- "anything. :( Use my subclasses." if self.class == Encoder
$ALREADY_WARNED_OLD_INTERFACE = false
end
@@ -133,6 +131,7 @@ module CodeRay
# Called for each text token ([text, kind]), where text is a String.
def text_token text, kind
+ @out << text
end
# Starts a token group with the given +kind+.