Class: TorrentCrawler::Torrent
- Inherits:
-
Object
- Object
- TorrentCrawler::Torrent
- Defined in:
- lib/torrent_crawler/torrent.rb
Instance Attribute Summary collapse
-
#files ⇒ Object
Returns the value of attribute files.
-
#hash ⇒ Object
Returns the value of attribute hash.
-
#leechers ⇒ Object
Returns the value of attribute leechers.
-
#seeders ⇒ Object
Returns the value of attribute seeders.
-
#snatches ⇒ Object
Returns the value of attribute snatches.
-
#title ⇒ Object
Returns the value of attribute title.
-
#tracker_id ⇒ Object
Returns the value of attribute tracker_id.
-
#tracker_key ⇒ Object
Returns the value of attribute tracker_key.
-
#uploaded_at ⇒ Object
Returns the value of attribute uploaded_at.
-
#uploader ⇒ Object
Returns the value of attribute uploader.
Instance Method Summary collapse
Instance Attribute Details
#files ⇒ Object
Returns the value of attribute files.
47 48 49 |
# File 'lib/torrent_crawler/torrent.rb', line 47 def files @files end |
#hash ⇒ Object
Returns the value of attribute hash.
15 16 17 |
# File 'lib/torrent_crawler/torrent.rb', line 15 def hash @hash end |
#leechers ⇒ Object
Returns the value of attribute leechers.
51 52 53 |
# File 'lib/torrent_crawler/torrent.rb', line 51 def leechers @leechers end |
#seeders ⇒ Object
Returns the value of attribute seeders.
49 50 51 |
# File 'lib/torrent_crawler/torrent.rb', line 49 def seeders @seeders end |
#snatches ⇒ Object
Returns the value of attribute snatches.
53 54 55 |
# File 'lib/torrent_crawler/torrent.rb', line 53 def snatches @snatches end |
#title ⇒ Object
Returns the value of attribute title.
17 18 19 |
# File 'lib/torrent_crawler/torrent.rb', line 17 def title @title end |
#tracker_id ⇒ Object
Returns the value of attribute tracker_id.
5 6 7 |
# File 'lib/torrent_crawler/torrent.rb', line 5 def tracker_id @tracker_id end |
#tracker_key ⇒ Object
Returns the value of attribute tracker_key.
3 4 5 |
# File 'lib/torrent_crawler/torrent.rb', line 3 def tracker_key @tracker_key end |
#uploaded_at ⇒ Object
Returns the value of attribute uploaded_at.
55 56 57 |
# File 'lib/torrent_crawler/torrent.rb', line 55 def uploaded_at @uploaded_at end |
#uploader ⇒ Object
Returns the value of attribute uploader.
19 20 21 |
# File 'lib/torrent_crawler/torrent.rb', line 19 def uploader @uploader end |
Instance Method Details
#id ⇒ Object
7 8 9 |
# File 'lib/torrent_crawler/torrent.rb', line 7 def id tracker_id end |
#id=(value) ⇒ Object
11 12 13 |
# File 'lib/torrent_crawler/torrent.rb', line 11 def id=(value) tracker_id = value end |
#size ⇒ Object
21 22 23 |
# File 'lib/torrent_crawler/torrent.rb', line 21 def size @size ||= 0 end |
#size=(value) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/torrent_crawler/torrent.rb', line 25 def size=(value) if value.respond_to? :downcase if value =~ /^([0-9\.]+)(.*)$/ value = $1.strip.to_f unit = $2.strip.gsub(/[^A-Za-z]/, '') case unit when /tb/i value *= 1024 * 1024 * 1024 when /gb/i value *= 1024 * 1024 when /mb/i, /megabytes?/i value *= 1024 end @size = value.to_i end else @size = value.to_i end end |
#tags ⇒ Object
57 58 59 |
# File 'lib/torrent_crawler/torrent.rb', line 57 def @tags ||= [] end |