don't let the lookup return nil
This commit is contained in:
parent
28b6092ea3
commit
3e9789880d
2 changed files with 4 additions and 3 deletions
|
@ -89,11 +89,11 @@ class HuffmanEncoding
|
|||
end
|
||||
|
||||
def encode(entry)
|
||||
self.lookup.invert[entry]
|
||||
self.lookup.invert[entry] || ""
|
||||
end
|
||||
|
||||
def decode(code)
|
||||
self.lookup[code]
|
||||
self.lookup[code] || ""
|
||||
end
|
||||
|
||||
def encode_list(list)
|
||||
|
|
3
thing.rb
3
thing.rb
|
@ -21,7 +21,8 @@ end
|
|||
require './huffman'
|
||||
|
||||
$log = Logger.new(STDERR)
|
||||
$log.level = Logger::DEBUG
|
||||
#$log.level = Logger::DEBUG
|
||||
$log.level = Logger::FATAL
|
||||
|
||||
class BitWriter
|
||||
|
||||
|
|
Loading…
Reference in a new issue