From 2b5a8db69e9b16235f02b5896a0680ba23fd38bd Mon Sep 17 00:00:00 2001 From: murphy Date: Mon, 20 Apr 2009 20:58:25 +0000 Subject: New: *JSON Encoder* Very simple. Not streamable yet. --- lib/coderay/encoders/json.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lib/coderay/encoders/json.rb (limited to 'lib/coderay/encoders/json.rb') diff --git a/lib/coderay/encoders/json.rb b/lib/coderay/encoders/json.rb new file mode 100644 index 0000000..6d789c6 --- /dev/null +++ b/lib/coderay/encoders/json.rb @@ -0,0 +1,19 @@ +module CodeRay +module Encoders + + # = JSON Encoder + class JSON < Encoder + + register_for :json + FILE_EXTENSION = 'json' + + protected + def compile tokens, options + require 'json' + @out = tokens.to_a.to_json + end + + end + +end +end -- cgit v1.2.1