lib/page_magic/watchers.rb in page_magic-1.0.1 vs lib/page_magic/watchers.rb in page_magic-1.0.2
- old
+ new
@@ -23,9 +23,10 @@
# # more complicated code to get value
# end
def watch(name, method = nil, &block)
fail ElementMissingException, (ELEMENT_MISSING_MSG % name) unless block || respond_to?(name)
watched_element = block ? Watcher.new(name, &block) : Watcher.new(name, method)
+ watchers.delete_if { |w| w.name == name }
watchers << watched_element.check(self)
end
# retrieve a watcher given its name
# @param [Symbol] name the name of the watcher