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
23 24 25 26 |
# File 'lib/god/conditions/always.rb', line 23 def initialize super self.info = 'always' end |
Instance Attribute Details
#what ⇒ Object
The Boolean determining whether this condition will always trigger (true) or never trigger (false).
21 22 23 |
# File 'lib/god/conditions/always.rb', line 21 def what @what end |
Instance Method Details
#test ⇒ Object
34 35 36 |
# File 'lib/god/conditions/always.rb', line 34 def test @what end |
#valid? ⇒ Boolean
28 29 30 31 32 |
# File 'lib/god/conditions/always.rb', line 28 def valid? valid = true valid &= complain("Attribute 'what' must be specified", self) if what.nil? valid end |