Fast encoder producing simple debug output.
It is readable and diff-able and is used for testing.
You cannot fully restore the tokens information from the output, because consecutive :space tokens are merged. Use Tokens#dump for caching purposes.
[Source]
# File lib/coderay/encoders/debug.rb, line 38 38: def begin_line kind 39: "#{kind}[" 40: end
# File lib/coderay/encoders/debug.rb, line 34 34: def close_token kind 35: ">" 36: end
# File lib/coderay/encoders/debug.rb, line 42 42: def end_line kind 43: "]" 44: end
# File lib/coderay/encoders/debug.rb, line 30 30: def open_token kind 31: "#{kind}<" 32: end
# File lib/coderay/encoders/debug.rb, line 21 21: def text_token text, kind 22: if kind == :space 23: text 24: else 25: text = text.gsub(/[)\\]/, '\\\\\0') # escape ) and "#{kind}(#{text})" 26: end 27: end
[Validate]