From ebab9d3ec5280066e443bfd19b43219dbef9b588 Mon Sep 17 00:00:00 2001 From: murphy Date: Tue, 29 Jun 2010 07:00:39 +0000 Subject: 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. --- lib/coderay/encoder.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/coderay/encoder.rb') 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+. -- cgit v1.2.1