Sha256: b454311af37d2671f67dfef8ce36e47f7007867a6c71579f7a523785c9752703

Contents?: true

Size: 882 Bytes

Versions: 4

Compression:

Stored size: 882 Bytes

Contents

# -*- coding: utf-8 -*-

require 'writeexcel/caller_info'

if defined?($debug)
  class BIFFWriter
    include CallerInfo

    def append(*args)
      data = args.collect{ |arg| arg.dup.force_encoding('ASCII-8BIT') }.join
      print_caller_info(data, :method => 'append')
      super
    end

    def prepend(*args)
      data = args.collect{ |arg| arg.dup.force_encoding('ASCII-8BIT') }.join
      print_caller_info(data, :method => 'prepend')
      super
    end

    def print_caller_info(data, param = {})
      infos = caller_info

      print "#{param[:method]}\n" if param[:method]
      infos.each do |info|
        print "#{info[:file]}:#{info[:line]}"
        print " in #{info[:method]}" if info[:method]
        print "\n"
      end
      print data.unpack('C*').map! {|byte| sprintf("%02X", byte) }.join(' ') + "\n\n"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
writeexcel-0.5.0 lib/writeexcel/debug_info.rb
writeexcel-0.4.3 lib/writeexcel/debug_info.rb
writeexcel-0.4.2 lib/writeexcel/debug_info.rb
writeexcel-0.4.1 lib/writeexcel/debug_info.rb