# File lib/god/condition.rb, line 9 def self.generate(kind, watch) sym = kind.to_s.capitalize.gsub(/_(.)/){$1.upcase}.intern c = God::Conditions.const_get(sym).new unless c.kind_of?(PollCondition) || c.kind_of?(EventCondition) || c.kind_of?(TriggerCondition) abort "Condition '#{c.class.name}' must subclass God::PollCondition, God::EventCondition, or God::TriggerCondition" end c.watch = watch c rescue NameError raise NoSuchConditionError.new("No Condition found with the class name God::Conditions::#{sym}") end