From 75bc5455af8c3c3381066aac3d5fff42264cac6f Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Fri, 19 Aug 2011 03:09:35 +0200 Subject: Major rewrite of encoders to support IO output; fixed some minor scanner bugs; cleanups; dropped NitroXHTML scanner; improved tests --- lib/coderay/encoder.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lib/coderay/encoder.rb') 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. -- cgit v1.2.1