6 # Generate a Behavior of the given kind. The proper class if found by camel casing the
7 # kind (which is given as an underscored symbol).
8 # +kind+ is the underscored symbol representing the class (e.g. foo_bar for God::Behaviors::FooBar)
9 def self.generate(kind, watch)
10 sym = kind.to_s.capitalize.gsub(/_(.)/){$1.upcase}.intern
11 b = God::Behaviors.const_get(sym).new
15 raise NoSuchBehaviorError.new("No Behavior found with the class name God::Behaviors::#{sym}")
18 # Override this method in your Behaviors (optional)
20 # Called once after the Condition has been sent to the block and attributes have been
21 # set. Do any post-processing on attributes here
26 # Override this method in your Behaviors (optional)
28 # Called once during evaluation of the config file. Return true if valid, false otherwise
30 # A convenience method 'complain' is available that will print out a message and return false,
31 # making it easy to report multiple validation errors:
35 # valid &= complain("You must specify the 'pid_file' attribute for :memory_usage") if self.pid_file.nil?
36 # valid &= complain("You must specify the 'above' attribute for :memory_usage") if self.above.nil?