Class: QuartzTorrent::TimerManager::TimerInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/quartz_torrent/timermanager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(duration, recurring, metainfo) ⇒ TimerInfo

Returns a new instance of TimerInfo.



7
8
9
10
11
12
13
# File 'lib/quartz_torrent/timermanager.rb', line 7

def initialize(duration, recurring, metainfo)
  @duration = duration
  @recurring = recurring
  @metainfo = metainfo
  @cancelled = false
  refresh
end

Instance Attribute Details

#cancelledObject

Since pqueue doesn’t allow removal of anything but the head we flag deleted items so they are deleted when they are pulled



20
21
22
# File 'lib/quartz_torrent/timermanager.rb', line 20

def cancelled
  @cancelled
end

#durationObject

Returns the value of attribute duration.



15
16
17
# File 'lib/quartz_torrent/timermanager.rb', line 15

def duration
  @duration
end

#expiryObject

Returns the value of attribute expiry.



16
17
18
# File 'lib/quartz_torrent/timermanager.rb', line 16

def expiry
  @expiry
end

#metainfoObject

Returns the value of attribute metainfo.



17
18
19
# File 'lib/quartz_torrent/timermanager.rb', line 17

def metainfo
  @metainfo
end

#recurringObject

Returns the value of attribute recurring.



14
15
16
# File 'lib/quartz_torrent/timermanager.rb', line 14

def recurring
  @recurring
end

Instance Method Details

#refreshObject



26
27
28
# File 'lib/quartz_torrent/timermanager.rb', line 26

def refresh
  @expiry = Time.new + @duration
end

#secondsUntilExpiryObject



22
23
24
# File 'lib/quartz_torrent/timermanager.rb', line 22

def secondsUntilExpiry
  @expiry - Time.new
end