Sha256: e4fef1c06508733f7527ddfae51c84e3507bf34efca0e675124a034ada239554
Contents?: true
Size: 495 Bytes
Versions: 3
Compression:
Stored size: 495 Bytes
Contents
class String # # Bencodes the String object. Bencoded strings are represented # as <code>x</code>:<code>y</code>, where +y+ is the string and +x+ # is the length of the string. # # "foo".bencode #=> "3:foo" # "".bencode #=> "0:" # def bencode "#{bytesize}:#{self}" end # # Bdecodes the String object and returns the data serialized # through bencoding. # # "li1ei2ei3ee".bdecode #=> [1, 2, 3] # def bdecode BEncode.load(self) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bencode-1.0.0 | lib/bencode/core_ext/string.rb |
bencode-0.8.2 | lib/bencode/core_ext/string.rb |
bencode-0.8.1 | lib/bencode/core_ext/string.rb |