class ChaosDetector::GraphTheory::LoopDetector
Public Class Methods
new(detection: :simple, lookback: 0, tolerance: 0, grace_period: 0)
click to toggle source
# File lib/chaos_detector/graph_theory/loop_detector.rb, line 5 def initialize(detection: :simple, lookback: 0, tolerance: 0, grace_period: 0) @detection = detection @lookback = lookback @tolerance = tolerance @grace_period = grace_period end
Private Class Methods
simple()
click to toggle source
# File lib/chaos_detector/graph_theory/loop_detector.rb, line 26 def simple @simple ||= LoopDetector.new end
Public Instance Methods
tolerates?(nodes, node)
click to toggle source
# File lib/chaos_detector/graph_theory/loop_detector.rb, line 12 def tolerates?(nodes, node) return true if (nodes.length <= @grace_period) # return false if (lookback.zero? && tolerance.zero? && nodes.include?(node)) # TODO: lookback nodes.count(node) > tolerance end
Private Instance Methods
form_lookback()
click to toggle source
# File lib/chaos_detector/graph_theory/loop_detector.rb, line 22 def form_lookback end