Sha256: 7e600f22109beb31dd72a6af6be4da6d2d8045cf6e2d8f382381d5700dc9c9e7

Contents?: true

Size: 376 Bytes

Versions: 4

Compression:

Stored size: 376 Bytes

Contents

class Array
  #
  # Bencodes the Array object. Bencoded arrays are represented as
  # +lxe+, where +x+ is zero or more bencoded objects.
  #
  #   [1, "foo"].bencode   #=> "li1e3:fooe"
  #
  def bencode
    begin
      "l#{map{|obj| obj.bencode }.join('')}e"
    rescue BEncode::EncodeError
      raise BEncode::EncodeError, "array items must be encodable"
    end
  end
end

Version data entries

4 entries across 4 versions & 3 rubygems

Version Path
dasch-bencode-0.5.0 lib/bencode/encode/array.rb
mikehodgson-bencode-0.5.0 lib/bencode/encode/array.rb
bencode-0.6.0 lib/bencode/encode/array.rb
bencode-0.5.1 lib/bencode/encode/array.rb