Sha256: 07708d30cc665d106b69b00d12f6ae0e03991b4faadf27b7cae41b444787f121

Contents?: true

Size: 832 Bytes

Versions: 2

Compression:

Stored size: 832 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
      end
      
      def end_parsing
      end
   end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
textpow-0.9.0 lib/textpow/debug_processor.rb
textpow-0.9.1 lib/textpow/debug_processor.rb