# File lib/god/watch.rb, line 46 def behavior(kind) # create the behavior begin b = Behavior.generate(kind, self) rescue NoSuchBehaviorError => e abort e.message end # send to block so config can set attributes yield(b) if block_given? # abort if the Behavior is invalid, the Behavior will have printed # out its own error messages by now abort unless b.valid? self.behaviors << b end