Class: ExtratorrentSearch::Link
- Inherits:
-
Object
- Object
- ExtratorrentSearch::Link
- Defined in:
- lib/extratorrent_search/link.rb
Overview
Object that contains the info for a torrent file
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#leechers ⇒ Object
readonly
Returns the value of attribute leechers.
-
#magnet_link ⇒ Object
readonly
Returns the value of attribute magnet_link.
-
#seeders ⇒ Object
readonly
Returns the value of attribute seeders.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #info_hash ⇒ Object
-
#initialize(filename: nil, size: nil, magnet_link: nil, seeders: nil, leechers: nil) ⇒ Link
constructor
A new instance of Link.
- #to_s ⇒ Object
Constructor Details
#initialize(filename: nil, size: nil, magnet_link: nil, seeders: nil, leechers: nil) ⇒ Link
Returns a new instance of Link.
10 11 12 13 14 15 16 |
# File 'lib/extratorrent_search/link.rb', line 10 def initialize(filename: nil, size: nil, magnet_link: nil, seeders: nil, leechers: nil) @filename = filename @size = size @magnet_link = magnet_link @seeders = seeders @leechers = leechers end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
8 9 10 |
# File 'lib/extratorrent_search/link.rb', line 8 def filename @filename end |
#leechers ⇒ Object (readonly)
Returns the value of attribute leechers.
8 9 10 |
# File 'lib/extratorrent_search/link.rb', line 8 def leechers @leechers end |
#magnet_link ⇒ Object (readonly)
Returns the value of attribute magnet_link.
8 9 10 |
# File 'lib/extratorrent_search/link.rb', line 8 def magnet_link @magnet_link end |
#seeders ⇒ Object (readonly)
Returns the value of attribute seeders.
8 9 10 |
# File 'lib/extratorrent_search/link.rb', line 8 def seeders @seeders end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
8 9 10 |
# File 'lib/extratorrent_search/link.rb', line 8 def size @size end |
Instance Method Details
#<=>(other) ⇒ Object
18 19 20 |
# File 'lib/extratorrent_search/link.rb', line 18 def <=>(other) @seeders <=> other.seeders end |
#info_hash ⇒ Object
26 27 28 |
# File 'lib/extratorrent_search/link.rb', line 26 def info_hash @info_hash ||= extract_hash end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/extratorrent_search/link.rb', line 22 def to_s "#{@filename} (#{@size}) - [#{@seeders.green}/#{@leechers.red}]" end |