class QuartzTorrent::Metainfo::Info

Attributes

files[RW]

Array of FileInfo objects

name[RW]

Suggested file or directory name

pieceLen[RW]

Length of each piece in bytes. The last piece may be shorter than this.

pieces[RW]

Array of SHA1 digests of all peices. These digests are in binary format.

private[RW]

True if no external peer source is allowed.

Public Class Methods

new() click to toggle source
# File lib/quartz_flow/mock_client.rb, line 44
def initialize
  @files = []
  @name = nil
  @pieceLen = 0
  @pieces = []
  @private = false
end

Public Instance Methods

dataLength() click to toggle source

Total length of the torrent data in bytes.

# File lib/quartz_flow/mock_client.rb, line 64
def dataLength
  files.reduce(0){ |memo,f| memo + f.length}
end
to_h() click to toggle source
# File lib/quartz_flow/wrappers.rb, line 12
def to_h
  result = {}

  result[:name] = @name
  result[:pieceLen] = @pieceLen
  result[:files] = @files.collect{ |e| e.to_h }

  result
end