diff options
Diffstat (limited to 'lib/coderay/encoders')
-rw-r--r-- | lib/coderay/encoders/debug.rb | 10 | ||||
-rw-r--r-- | lib/coderay/encoders/debug_lint.rb | 4 |
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/coderay/encoders/debug.rb b/lib/coderay/encoders/debug.rb index f4db330..6b680fc 100644 --- a/lib/coderay/encoders/debug.rb +++ b/lib/coderay/encoders/debug.rb @@ -15,9 +15,12 @@ module Encoders register_for :debug + attr_reader :size + FILE_EXTENSION = 'raydebug' def text_token text, kind + @size += 1 if kind == :space @out << text else @@ -43,6 +46,13 @@ module Encoders @out << ']' end + protected + + def setup options + super + @size = 0 + end + end end diff --git a/lib/coderay/encoders/debug_lint.rb b/lib/coderay/encoders/debug_lint.rb index a4eba2c..497d8c5 100644 --- a/lib/coderay/encoders/debug_lint.rb +++ b/lib/coderay/encoders/debug_lint.rb @@ -29,7 +29,7 @@ module Encoders end def end_group kind - raise Lint::IncorrectTokenGroupNesting, 'We are inside %s, not %p (end_group)' % [@opened.reverse.map(&:inspect).join(' < '), kind] if @opened.last != kind + raise Lint::IncorrectTokenGroupNesting, 'We are inside %p, not %p (end_group)' % [@opened.reverse, kind] if @opened.last != kind @opened.pop super end @@ -40,7 +40,7 @@ module Encoders end def end_line kind - raise Lint::IncorrectTokenGroupNesting, 'We are inside %s, not %p (end_line)' % [@opened.reverse.map(&:inspect).join(' < '), kind] if @opened.last != kind + raise Lint::IncorrectTokenGroupNesting, 'We are inside %p, not %p (end_line)' % [@opened.reverse, kind] if @opened.last != kind @opened.pop super end |