diff options
Diffstat (limited to 'lib/coderay')
-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 |