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