Class: Torrent

Inherits:
Object
  • Object
show all
Defined in:
lib/model/torrent_model.rb

Overview

Model for saving torrent info

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(torrent_file, name, size, seeders, leechers) ⇒ Torrent

Returns a new instance of Torrent.



5
6
7
8
9
10
11
# File 'lib/model/torrent_model.rb', line 5

def initialize(torrent_file, name, size, seeders, leechers)
  @torrent_file = torrent_file
  @name = name
  @size = size
  @seeders = seeders
  @leechers = leechers
end

Instance Attribute Details

#leechersObject (readonly)

Returns the value of attribute leechers.



29
30
31
# File 'lib/model/torrent_model.rb', line 29

def leechers
  @leechers
end

#nameObject (readonly)

Returns the value of attribute name.



26
27
28
# File 'lib/model/torrent_model.rb', line 26

def name
  @name
end

#seedersObject (readonly)

Returns the value of attribute seeders.



28
29
30
# File 'lib/model/torrent_model.rb', line 28

def seeders
  @seeders
end

#sizeObject (readonly)

Returns the value of attribute size.



27
28
29
# File 'lib/model/torrent_model.rb', line 27

def size
  @size
end

#torrent_fileObject (readonly)

Returns the value of attribute torrent_file.



25
26
27
# File 'lib/model/torrent_model.rb', line 25

def torrent_file
  @torrent_file
end

Instance Method Details

#to_sObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/model/torrent_model.rb', line 13

def to_s
  string = StringIO.open do |s|
    s.puts 'torrent_file: ' + @torrent_file.to_s
    s.puts 'name: ' + @name.to_s
    s.puts 'size: ' + @size.to_s
    s.puts 'seeders: ' + @seeders.to_s
    s.puts 'leechers: ' + @leechers.to_s
    s.string
  end
  string
end