Class: Object

Inherits:
BasicObject
Defined in:
lib/bencode.rb

Overview

bencode is a Ruby implementation of the Bencode data serialization format used in the BitTorrent protocol.

Synopsis

"foobar".bencode   #=> "6:foobar"
42.bencode         #=> "i42e"
[1, 2, 3].bencode  #=> "li1ei2ei3ee"

Authors

  • Daniel Schierbeck

Contributors

  • Daniel Martin

  • Phrogz

Bencode is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Bencode is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Instance Method Summary collapse

Instance Method Details

#bencodeObject

Raises an exception. Subclasses of Object must themselves define meaningful #bencode methods.

Raises:



36
37
38
# File 'lib/bencode.rb', line 36

def bencode
  raise BencodeError, self.class
end