README.md in huffman_coding-1.0.0 vs README.md in huffman_coding-1.1.0
- old
+ new
@@ -23,9 +23,29 @@
$ gem install huffman_coding
## Usage
+### Encode
+```rb
+coding = HuffmanCoding.encode('A short test.'.each_char)
+coding.binary
+# => "6\x88BwV"
+
+coding.last_byte_bits
+# => 8
+
+coding.code_table
+# => {"e"=>"111", "."=>"110", "t"=>"10", " "=>"011", "s"=>"010", "A"=>"0011", "h"=>"0010", "o"=>"0001", "r"=>"0000"}
+```
+
+### Decode
+```rb
+coding = HuffmanCoding.new("6\x88BwV", 8 "e"=>"111", "."=>"110", "t"=>"10", " "=>"011", "s"=>"010", "A"=>"0011", "h"=>"0010", "o"=>"0001", "r"=>"0000")
+HuffmanCoding.decode(coding)
+# => 'A short test.'
+```
+
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.