Class: Torrent
- Inherits:
-
Object
- Object
- Torrent
- Defined in:
- lib/model/torrent_model.rb
Overview
Model for saving torrent info
Instance Attribute Summary collapse
-
#leechers ⇒ Object
readonly
Returns the value of attribute leechers.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#seeders ⇒ Object
readonly
Returns the value of attribute seeders.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#torrent_file ⇒ Object
readonly
Returns the value of attribute torrent_file.
Instance Method Summary collapse
-
#initialize(torrent_file, name, size, seeders, leechers) ⇒ Torrent
constructor
A new instance of Torrent.
- #to_s ⇒ Object
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
#leechers ⇒ Object (readonly)
Returns the value of attribute leechers.
29 30 31 |
# File 'lib/model/torrent_model.rb', line 29 def leechers @leechers end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
26 27 28 |
# File 'lib/model/torrent_model.rb', line 26 def name @name end |
#seeders ⇒ Object (readonly)
Returns the value of attribute seeders.
28 29 30 |
# File 'lib/model/torrent_model.rb', line 28 def seeders @seeders end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
27 28 29 |
# File 'lib/model/torrent_model.rb', line 27 def size @size end |
#torrent_file ⇒ Object (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_s ⇒ Object
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 |