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