Module: RubyTorrent

Defined in:
lib/rubytorrent/package.rb,
lib/rubytorrent.rb,
lib/rubytorrent/peer.rb,
lib/rubytorrent/util.rb,
lib/rubytorrent/server.rb,
lib/rubytorrent/message.rb,
lib/rubytorrent/tracker.rb,
lib/rubytorrent/metainfo.rb,
lib/rubytorrent/bencoding.rb,
lib/rubytorrent/controller.rb,
lib/rubytorrent/typedstruct.rb

Overview

MetaInfo file is the parsed form of the .torrent file that people send around. It contains a MetaInfoInfo and possibly some MetaInfoInfoFile objects.

Defined Under Namespace

Modules: ArrayDelete2, ArrayShuffle, ArrayToBitstring, ArrayToH, ArrayUniq2, AttrReaderQ, EventSource, HashAddition, HashMapHash, MinIntervalMethods, StringExpandBits, StringMapBytes, StringToBarray Classes: AwesomeRange, BEncodingError, BStream, BitTorrent, Block, Controller, Covering, Message, MetaInfo, MetaInfoFormatError, MetaInfoInfo, MetaInfoInfoFile, Package, PeerConnection, Piece, PieceOrder, ProtocolError, RateMeter, Server, TrackerConnection, TrackerError, TrackerResponse, TrackerResponsePeer, TypedStruct, TypedStructError

Constant Summary collapse

VERSION =
0.3

Class Method Summary collapse

Class Method Details

.get_args(rest, *names) ⇒ Object

parse final hash of pseudo-keyword arguments



41
42
43
44
45
46
47
48
49
# File 'lib/rubytorrent/util.rb', line 41

def get_args(rest, *names)
  hash = rest.find { |x| x.is_a? Hash }
  if hash
    rest.delete hash
    hash.each { |k, v| raise ArgumentError, %{unknown argument "#{k}"} unless names.include?(k) }
  end

  [hash || {}, rest]
end

.logObject

Returns the value of attribute log.



36
37
38
# File 'lib/rubytorrent/util.rb', line 36

def log
  @log
end

.log_output_to(fn) ⇒ Object



33
34
35
# File 'lib/rubytorrent/util.rb', line 33

def log_output_to(fn)
  @log = File.open(fn, "w")
end