Sha256: fdf56a22b6aeeefd119386a46a7abf685f0afdfa272e7fde1c460c73883931d9

Contents?: true

Size: 291 Bytes

Versions: 10

Compression:

Stored size: 291 Bytes

Contents

class Integer
  #
  # 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"
  def bencode
    "i#{self}e"
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
bencode-1.0.0 lib/bencode/core_ext/integer.rb
bencode-0.8.2 lib/bencode/core_ext/integer.rb
dasch-bencode-0.5.0 lib/bencode/encode/integer.rb
mikehodgson-bencode-0.5.0 lib/bencode/encode/integer.rb
bencode-0.8.1 lib/bencode/core_ext/integer.rb
bencode-0.8.0 lib/bencode/core_ext/integer.rb
bencode-0.7.0 lib/bencode/core_ext/integer.rb
bencode-0.6.0 lib/bencode/encode/integer.rb
bencode-0.5.1 lib/bencode/encode/integer.rb
bencode-0.5.0 lib/bencode/encode/integer.rb