Module: BEncode::String::Generic::InstanceMethods
- Defined in:
- lib/bencode/string.rb
Instance Method Summary collapse
-
#bencode ⇒ ::String
Encodes object into a bencoded string.
Instance Method Details
#bencode ⇒ ::String
Encodes object into a bencoded string. BEncoded strings are length-prefixed base ten followed by a colon and the string.
:symbol.bencode #=> "6:symbol"
15 16 17 |
# File 'lib/bencode/string.rb', line 15 def bencode (respond_to?(:to_s) ? to_s : to_str).bencode end |