README.rdoc in bencodr-1.0.1 vs README.rdoc in bencodr-1.1.0

- old
+ new

@@ -10,11 +10,11 @@ This gem provides a way to encode and parse bencodings used by the Bit Torrent protocol. == Installation # install the gem - > gem install bencodr + > [sudo] gem install bencodr Successfully installed bencodr 1 gem installed Installing ri documentation for bencodr... Building YARD (yri) index for bencodr... Installing RDoc documentation for bencodr @@ -78,15 +78,23 @@ {array => array}.bencode #=> "d12:[1, 2, 3, 4]li1ei2ei3ei4eee" # Note: keys are sorted as raw strings. {:a => 1, "A" => 1, 1=> 1}.bencode #=> "d1:1i1e1:Ai1e1:ai1ee" -=== Encoding and Decoding +=== Decoding +You can decode a bencoding by calling bdecode on the string. + "6:string".bdecode #=> "string" + "i1e".bdecode #=> 1 + "le".bdecode #=> [] + "de".bdecode #=> {} + +=== Encoding and Decoding with BEncodr + # encoding is just like calling bencode on the object BEncodr.encode("string") #=> "6:string" - # decoding takes a string and return either a String, Integer, Array, or Hash + # decoding is just like calling bdecode on a bencoding BEncodr.decode("6:string") #=> "string" BEncodr.decode("i1e") #=> 1 BEncodr.decode("le") #=> [] BEncodr.decode("de") #=> {}