Sha256: b65258e5105baa6acaf50f7a82fdf75fa3d6a43c2e3a2da30914dabe06495ded

Contents?: true

Size: 906 Bytes

Versions: 10

Compression:

Stored size: 906 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

10 entries across 10 versions & 5 rubygems

Version Path
spox-textpow-0.10.2 lib/textpow/debug_processor.rb
ultra_pow_list-0.1.1 lib/ultra_pow_list/vendor/ruby1.8/textpow/textpow/debug_processor.rb
ultra_pow_list-0.1.0 lib/ultra_pow_list/vendor/ruby1.8/textpow/textpow/debug_processor.rb
spox-textpow-0.10.3 lib/textpow/debug_processor.rb
textpow19-0.11.0 lib/textpow/debug_processor.rb
kitabu-0.4.7 lib/kitabu/vendor/ruby1.8/textpow/textpow/debug_processor.rb
kitabu-0.4.6 lib/kitabu/vendor/ruby1.8/textpow/textpow/debug_processor.rb
kitabu-0.4.5 lib/kitabu/vendor/ruby1.8/textpow/textpow/debug_processor.rb
textpow-0.10.1 lib/textpow/debug_processor.rb
textpow-0.10.0 lib/textpow/debug_processor.rb