class God::Behavior
Attributes
watch[RW]
Public Class Methods
generate(kind, watch)
click to toggle source
Generate a Behavior of the given kind. The proper class is 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)
# File lib/god/behavior.rb, line 11 def self.generate(kind, watch) sym = kind.to_s.capitalize.gsub(/_(.)/){$1.upcase}.intern b = God::Behaviors.const_get(sym).new b.watch = watch b rescue NameError raise NoSuchBehaviorError.new("No Behavior found with the class name God::Behaviors::#{sym}") end
Public Instance Methods
after_restart()
click to toggle source
# File lib/god/behavior.rb, line 35 def after_restart end
after_start()
click to toggle source
# File lib/god/behavior.rb, line 29 def after_start end
after_stop()
click to toggle source
# File lib/god/behavior.rb, line 41 def after_stop end
before_restart()
click to toggle source
# File lib/god/behavior.rb, line 32 def before_restart end
before_start()
click to toggle source
# File lib/god/behavior.rb, line 26 def before_start end
before_stop()
click to toggle source
# File lib/god/behavior.rb, line 38 def before_stop end
friendly_name()
click to toggle source
Construct the friendly name of this Behavior, looks like:
Behavior FooBar on Watch 'baz'
Calls superclass method
God::Configurable#friendly_name
# File lib/god/behavior.rb, line 47 def friendly_name "Behavior " + super + " on Watch '#{self.watch.name}'" end
valid?()
click to toggle source
# File lib/god/behavior.rb, line 20 def valid? true end