summaryrefslogtreecommitdiff
path: root/lib/coderay/encoder.rb
diff options
context:
space:
mode:
authorKornelius Kalnbach <murphy@rubychan.de>2011-08-19 03:09:35 +0200
committerKornelius Kalnbach <murphy@rubychan.de>2011-08-19 03:09:35 +0200
commit75bc5455af8c3c3381066aac3d5fff42264cac6f (patch)
tree589d2c912ddd94c517eb794bcdf3257f8348f3c0 /lib/coderay/encoder.rb
parentfdd17b6a09efb275238a3baef275465d31452f2a (diff)
downloadcoderay-75bc5455af8c3c3381066aac3d5fff42264cac6f.tar.gz
Major rewrite of encoders to support IO output; fixed some minor scanner bugs; cleanups; dropped NitroXHTML scanner; improved tests
Diffstat (limited to 'lib/coderay/encoder.rb')
-rw-r--r--lib/coderay/encoder.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/coderay/encoder.rb b/lib/coderay/encoder.rb
index 85a2456..cc331d1 100644
--- a/lib/coderay/encoder.rb
+++ b/lib/coderay/encoder.rb
@@ -153,7 +153,17 @@ module CodeRay
#
# See the HTML Encoder for an example of option caching.
def setup options
- @out = ''
+ @out = get_output(options)
+ end
+
+ def get_output options
+ options[:out] || ''
+ end
+
+ # Append data.to_s to the output. Returns the argument.
+ def output data
+ @out << data.to_s
+ data
end
# Called with merged options after encoding starts.