Sha256: 4ee5e17022e65d6a7210b89b6ed8e149bcf201c9cf4f22f7b6d93b1523211a57
Contents?: true
Size: 336 Bytes
Versions: 1
Compression:
Stored size: 336 Bytes
Contents
module Huff class Encoder def initialize(tree) @table = EncodingTableBuilder.new(tree).table end def encode_string(text) text.each_char.each_with_object('') do |char, result| result << @table[char] end end def encode_36(text) encode_string(text).to_i(2).to_s(36) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
huff-0.0.2 | lib/huff/encoder.rb |