Module: BEncode::List::Generic::InstanceMethods
- Defined in:
- lib/bencode/list.rb
Instance Method Summary collapse
-
#bencode ⇒ ::String
Encodes object into a bencoded list.
Instance Method Details
#bencode ⇒ ::String
Encodes object into a bencoded list. BEncoded strings are length-prefixed base ten followed by a colon and the string. Object must implement to_a or to_ary.
[].bencode #=> "le"
13 14 15 |
# File 'lib/bencode/list.rb', line 13 def bencode (respond_to?(:to_ary) ? to_ary : to_a).bencode end |