Class God::Behavior
In: lib/god/behavior.rb
Parent: Base

Methods

Public Class methods

Generate a Behavior of the given kind. The proper class if found by camel casing the kind (which is given as an underscored symbol).

  +kind+ is the underscored symbol representing the class (e.g. foo_bar for God::Behaviors::FooBar)

Public Instance methods

Override this method in your Behaviors (optional)

Called once after the Condition has been sent to the block and attributes have been set. Do any post-processing on attributes here

Override this method in your Behaviors (optional)

Called once during evaluation of the config file. Return true if valid, false otherwise

A convenience method ‘complain’ is available that will print out a message and return false, making it easy to report multiple validation errors:

  def valid?
    valid = true
    valid &= complain("You must specify the 'pid_file' attribute for :memory_usage") if self.pid_file.nil?
    valid &= complain("You must specify the 'above' attribute for :memory_usage") if self.above.nil?
    valid
  end

Protected Instance methods

[Validate]