Class: UTorrent::File
Constant Summary collapse
- PRIORITIES =
{ 0 => "Don't Download", 1 => 'Low Priority', 2 => 'Normal Priority', 3 => 'High Priority', }
- ATTRIBUTES =
[ :name, :size, :downloaded, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil ]
Instance Attribute Summary collapse
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#torrent_id ⇒ Object
readonly
Returns the value of attribute torrent_id.
Attributes included from Base
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(array, index, torrent_id) ⇒ File
constructor
A new instance of File.
- #priority ⇒ Object
- #priority=(priority) ⇒ Object
- #priority_display_value ⇒ Object
- #refresh! ⇒ Object
- #skip ⇒ Object
Methods included from Base
Constructor Details
#initialize(array, index, torrent_id) ⇒ File
Returns a new instance of File.
23 24 25 26 27 |
# File 'lib/u_torrent/file.rb', line 23 def initialize(array, index, torrent_id) super(array) @index = index @torrent_id = torrent_id end |
Instance Attribute Details
#index ⇒ Object (readonly)
Returns the value of attribute index.
17 18 19 |
# File 'lib/u_torrent/file.rb', line 17 def index @index end |
#torrent_id ⇒ Object (readonly)
Returns the value of attribute torrent_id.
17 18 19 |
# File 'lib/u_torrent/file.rb', line 17 def torrent_id @torrent_id end |
Class Method Details
Instance Method Details
#priority ⇒ Object
33 34 35 |
# File 'lib/u_torrent/file.rb', line 33 def priority @raw_array[3] end |
#priority=(priority) ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/u_torrent/file.rb', line 41 def priority=(priority) UTorrent::Http.get_with_authentication( action: 'setprio', hash: torrent_id, f: index, p: priority ) refresh! end |
#priority_display_value ⇒ Object
29 30 31 |
# File 'lib/u_torrent/file.rb', line 29 def priority_display_value PRIORITIES[priority] end |
#refresh! ⇒ Object
51 52 53 54 |
# File 'lib/u_torrent/file.rb', line 51 def refresh! file = self.class.find_by_torrent_id_and_index(torrent_id, index) @raw_array = file.raw_array end |
#skip ⇒ Object
37 38 39 |
# File 'lib/u_torrent/file.rb', line 37 def skip send(:priority=, 0) end |