Method: String#bencode
- Defined in:
- lib/bencode.rb
#bencode ⇒ Object
Bencodes the String object. Bencoded strings are represented as x:y, where y is the string and x is the length of the string.
"foo".bencode #=> "3:foo"
"".bencode #=> "0:"
61 62 63 |
# File 'lib/bencode.rb', line 61 def bencode "#{length}:#{self}" end |