Class: Integer

Inherits:
Object show all
Defined in:
lib/bencode/core_ext/integer.rb

Instance Method Summary collapse

Instance Method Details

#bencodeObject

Bencodes the Integer object. Bencoded integers are represented as ixe, where x is the integer with an optional hyphen prepended, indicating negativity.

42.bencode   #=> "i42e"
-7.bencode   #=> "i-7e"


10
11
12
# File 'lib/bencode/core_ext/integer.rb', line 10

def bencode
  "i#{self}e"
end