Ruby implementation of scaling LZW compression