Class: God::Conditions::Lambda
- Inherits:
-
PollCondition
- Object
- Behavior
- God::Condition
- PollCondition
- God::Conditions::Lambda
- Defined in:
- lib/god/conditions/lambda.rb
Instance Attribute Summary collapse
-
#lambda ⇒ Object
Returns the value of attribute lambda.
Attributes inherited from PollCondition
Attributes inherited from God::Condition
#info, #notify, #phase, #transition
Attributes inherited from Behavior
Instance Method Summary collapse
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
Instance Attribute Details
#lambda ⇒ Object
Returns the value of attribute lambda.
5 6 7 |
# File 'lib/god/conditions/lambda.rb', line 5 def lambda @lambda end |
Instance Method Details
#test ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/god/conditions/lambda.rb', line 13 def test if self.lambda.call() self.info = "lambda condition was satisfied" true else self.info = "lambda condition was not satisfied" false end end |
#valid? ⇒ Boolean
7 8 9 10 11 |
# File 'lib/god/conditions/lambda.rb', line 7 def valid? valid = true valid &= complain("Attribute 'lambda' must be specified", self) if self.lambda.nil? valid end |