Sha256: 302edd26e7fdde54f1a6602fe83c9e8877266de7379b2765d7976422cc6e2748

Contents?: true

Size: 801 Bytes

Versions: 12

Compression:

Stored size: 801 Bytes

Contents

module Textpow
  class DebugProcessor
    def initialize
      @line_number = 0
      @printable_line = ""
    end

    def pprint line, string, position = 0
      line.replace line.ljust( position + string.size, " ")
      line[position,string.size] = string
      line
    end

    def open_tag name, position
      STDERR.puts pprint( "", "{#{name}", position + @line_marks.size)
    end

    def close_tag name, position
      STDERR.puts pprint( "", "}#{name}", position + @line_marks.size)
    end

    def new_line line
      @line_number += 1
      @line_marks = "[#{@line_number.to_s.rjust( 4, '0' )}] "
      STDERR.puts "#{@line_marks}#{line}"
    end

    def start_parsing name
      STDERR.puts "{#{name}"
    end

    def end_parsing name
      STDERR.puts "}#{name}"
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
textpow-1.4.0 lib/textpow/debug_processor.rb
textpow-1.3.1 lib/textpow/debug_processor.rb
textpow-1.3.0 lib/textpow/debug_processor.rb
textpow1x-1.2.5 lib/textpow/debug_processor.rb
textpow1x-1.2.4 lib/textpow/debug_processor.rb
textpow1x-1.2.3 lib/textpow/debug_processor.rb
textpow1x-1.2.2 lib/textpow/debug_processor.rb
textpow1x-1.2.1 lib/textpow/debug_processor.rb
textpow1x-1.2.0 lib/textpow/debug_processor.rb
textpow1x-1.1.0 lib/textpow/debug_processor.rb
textpow1x-1.0.0 lib/textpow/debug_processor.rb
textpow1x-0.11.0 lib/textpow/debug_processor.rb