diff options
author | murphy <murphy@rubychan.de> | 2009-04-20 20:58:25 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2009-04-20 20:58:25 +0000 |
commit | 2b5a8db69e9b16235f02b5896a0680ba23fd38bd (patch) | |
tree | 1f42de1fbb2a081ef0a73c5a55aa1e6ff0fe141b /lib/coderay/encoders/json.rb | |
parent | 078ea65a5deb2c1ee6c4b982a20856e2d186536d (diff) | |
download | coderay-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.rb | 19 |
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 |