Methods

Files

Class/Module Index [+]

Quicksearch

God::Conditions::DegradingLambda

This condition degrades its interval by a factor of two for 3 tries before failing

Attributes

lambda[RW]

Public Class Methods

new() click to toggle source
# File lib/god/conditions/degrading_lambda.rb, line 8
def initialize
  super
  @tries = 0
end

Public Instance Methods

test() click to toggle source
# File lib/god/conditions/degrading_lambda.rb, line 19
def test
  puts "Calling test. Interval at #{self.interval}"
  @original_interval ||= self.interval
  unless pass?
    if @tries == 2
      self.info = "lambda condition was satisfied"
      return true
    end
    self.interval = self.interval / 2.0
    @tries += 1
  else
    @tries = 0
    self.interval = @original_interval
  end

  self.info = "lambda condition was not satisfied"
  false
end
valid?() click to toggle source
# File lib/god/conditions/degrading_lambda.rb, line 13
def valid?
  valid = true
  valid &= complain("Attribute 'lambda' must be specified", self) if self.lambda.nil?
  valid
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.