Class: God::Conditions::Always
- Inherits:
-
PollCondition
- Object
- Behavior
- God::Condition
- PollCondition
- God::Conditions::Always
- Defined in:
- lib/god/conditions/always.rb
Overview
Always trigger or never trigger.
Examples
# Always trigger.
on.condition(:always) do |c|
c.what = true
end
# Never trigger.
on.condition(:always) do |c|
c.what = false
end
Instance Attribute Summary collapse
-
#what ⇒ Object
The Boolean determining whether this condition will always trigger (true) or never trigger (false).
Attributes inherited from PollCondition
Attributes inherited from God::Condition
#info, #notify, #phase, #transition
Attributes inherited from Behavior
Instance Method Summary collapse
-
#initialize ⇒ Always
constructor
A new instance of Always.
- #test ⇒ Object
- #valid? ⇒ Boolean
Methods inherited from PollCondition
Methods inherited from God::Condition
#friendly_name, generate, valid?
Methods inherited from Behavior
#after_restart, #after_start, #after_stop, #before_restart, #before_start, #before_stop, #friendly_name, generate
Methods included from God::Configurable
#base_name, complain, #complain, #friendly_name, #prepare, #reset
Constructor Details
#initialize ⇒ Always
Returns a new instance of Always.
21 22 23 |
# File 'lib/god/conditions/always.rb', line 21 def initialize self.info = "always" end |
Instance Attribute Details
#what ⇒ Object
The Boolean determining whether this condition will always trigger (true) or never trigger (false).
19 20 21 |
# File 'lib/god/conditions/always.rb', line 19 def what @what end |
Instance Method Details
#test ⇒ Object
31 32 33 |
# File 'lib/god/conditions/always.rb', line 31 def test @what end |
#valid? ⇒ Boolean
25 26 27 28 29 |
# File 'lib/god/conditions/always.rb', line 25 def valid? valid = true valid &= complain("Attribute 'what' must be specified", self) if self.what.nil? valid end |