def condition(kind)
begin
c = Condition.generate(kind, self.watch)
rescue NoSuchConditionError => e
abort e.message
end
yield(c) if block_given?
c.prepare
unless Condition.valid?(c) && c.valid?
abort "Exiting on invalid condition"
end
if c.kind_of?(PollCondition) && !c.interval
if self.watch.interval
c.interval = self.watch.interval
else
abort "No interval set for Condition '#{c.class.name}' in Watch " +
"'#{self.watch.name}', and no default Watch interval from " +
"which to inherit."
end
end
self.conditions << c
end