class TTWatcher::TorrentList

Public Class Methods

new() click to toggle source

Creates new TorrentList instance.

@return [TorrentList]

# File sources/ttwatcher/torrent_list.rb, line 37
def initialize
  @torrents = []
end

Public Instance Methods

+(other)
Alias for: push
<<(other)
Alias for: push
each(&block) click to toggle source
# File sources/ttwatcher/torrent_list.rb, line 41
def each(&block) # for Enumerable mixin
  @torrents.each { |obj| block.call obj }
end
push(other) click to toggle source

Pushes new torrents into TorrentList.

@param [Torrent, TorrentList] other

@exception UnexpectedClass

Raised when +other+ param class is not +Torrent+ or +TorrentList+

@return [TorrentList<Torrent>]

# File sources/ttwatcher/torrent_list.rb, line 17
def push(other)
  case other
  when Torrent
    @torrents.push other
  when TorrentList
    @torrents += other.to_a
  else
    raise UnexpectedClass, other
  end

  return self
end
Also aliased as: <<, +