adding logging to track where this nil is comming from

This commit is contained in:
Vincent Batts 2012-08-06 14:32:17 -04:00
parent f4777de387
commit 28b6092ea3

View file

@ -1,8 +1,15 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
=begin
usage: ruby ./thing.rb [cd] 5286016419950084643.pem
=end
# stdlib
require 'openssl' require 'openssl'
require 'zlib' require 'zlib'
require 'stringio' require 'stringio'
require 'logger'
# gems
require 'rubygems' require 'rubygems'
begin begin
require 'json' require 'json'
@ -10,9 +17,11 @@ rescue
abort('ERROR: plz2run #> gem install json') abort('ERROR: plz2run #> gem install json')
end end
# local
require './huffman' require './huffman'
# usage: ./content_from_pem.rb 5286016419950084643.pem $log = Logger.new(STDERR)
$log.level = Logger::DEBUG
class BitWriter class BitWriter
@ -199,6 +208,7 @@ def binary_write(file, parent, string_huff, node_huff)
# file.write(child.path) # file.write(child.path)
# file.write("\0") # file.write("\0")
# index of path string # index of path string
$log.debug('binary_write') { "path: " + path.inspect + "; encoded: " + string_huff.encode(path).inspect }
file.write_bits(string_huff.encode(path)) file.write_bits(string_huff.encode(path))
# offset to node # offset to node
# index of node, that is. # index of node, that is.