more bug fixes

This commit is contained in:
Sami Samhuri 2013-08-24 18:20:56 -07:00
parent ecd8249271
commit 847d133594
3 changed files with 14 additions and 3 deletions

View file

@ -38,6 +38,10 @@ module Kwikemon
redis.sadd(key('monitors'), name)
end
Monitor.on(:remove) do |name|
redis.srem(key('monitors'), name)
end
# Set `name` to `value`.
#
@ -95,7 +99,7 @@ module Kwikemon
# Remove the monitor named `name`.
def remove(name)
Monitor.new(name).delete
Monitor.new(name).remove
end
# Clear all monitors.
@ -112,6 +116,7 @@ module Kwikemon
end
end
private
def config

View file

@ -53,6 +53,12 @@ module Kwikemon
self
end
def remove
redis.del(key)
self.class.emit(:remove, name)
self
end
def key
Kwikemon.key("monitor:#{name}")
end
@ -70,7 +76,7 @@ module Kwikemon
end
def text
@text ||= exists? ? redis.hget(key, 'name') : nil
@text ||= exists? ? redis.hget(key, 'text') : nil
end

View file

@ -1,3 +1,3 @@
module Kwikemon
VERSION = '0.0.5'
VERSION = '0.0.6'
end