Class: QuartzTorrent::Alarms

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

Instance Method Summary collapse

Constructor Details

#initializeAlarms

Returns a new instance of Alarms.



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

def initialize
  @alarms = {}
end

Instance Method Details

#allObject



32
33
34
# File 'lib/quartz_torrent/alarm.rb', line 32

def all
  @alarms.values
end

#clear(alarm) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/quartz_torrent/alarm.rb', line 23

def clear(alarm)
  if alarm.is_a?(Alarm)
    @alarms.delete alarm.id
  else
    # Assume variable `alarm` is an id.
    @alarms.delete alarm
  end
end

#raise(alarm) ⇒ Object

Raise a new alarm, or overwrite the existing alarm with the same id if one exists.



19
20
21
# File 'lib/quartz_torrent/alarm.rb', line 19

def raise(alarm)
  @alarms[alarm.id] = alarm
end