summaryrefslogtreecommitdiff
path: root/lib/coderay/encoders/json.rb
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2009-04-20 20:58:25 +0000
committermurphy <murphy@rubychan.de>2009-04-20 20:58:25 +0000
commit2b5a8db69e9b16235f02b5896a0680ba23fd38bd (patch)
tree1f42de1fbb2a081ef0a73c5a55aa1e6ff0fe141b /lib/coderay/encoders/json.rb
parent078ea65a5deb2c1ee6c4b982a20856e2d186536d (diff)
downloadcoderay-2b5a8db69e9b16235f02b5896a0680ba23fd38bd.tar.gz
New: *JSON Encoder*
Very simple. Not streamable yet.
Diffstat (limited to 'lib/coderay/encoders/json.rb')
-rw-r--r--lib/coderay/encoders/json.rb19
1 files changed, 19 insertions, 0 deletions
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