Class | CodeRay::Encoders::Debug |
In: |
lib/coderay/encoders/debug.rb
|
Parent: | Encoder |
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.
See also: Scanners::Debug
FILE_EXTENSION | = | 'raydebug' |
# File lib/coderay/encoders/debug.rb, line 21 21: def initialize options = {} 22: super 23: @opened = [] 24: end
# File lib/coderay/encoders/debug.rb, line 36 36: def begin_group kind 37: @opened << kind 38: @out << kind.to_s << '<' 39: end
# File lib/coderay/encoders/debug.rb, line 50 50: def begin_line kind 51: @out << kind.to_s << '[' 52: end
# File lib/coderay/encoders/debug.rb, line 41 41: def end_group kind 42: if @opened.last != kind 43: puts @out 44: raise "we are inside #{@opened.inspect}, not #{kind}" 45: end 46: @opened.pop 47: @out << '>' 48: end