Class: Updawg::DeviationCheck

Inherits:
Check
  • Object
show all
Defined in:
lib/updawg/checks/deviation_check.rb

Instance Attribute Summary

Attributes inherited from Check

#name

Instance Method Summary collapse

Methods inherited from Check

#error, #error!, #pass, #pass!, #perform, #warning, #warning!

Constructor Details

#initialize(name, options = {}, &block) ⇒ DeviationCheck

Returns a new instance of DeviationCheck.

Raises:

  • (ArgumentError)


5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/updawg/checks/deviation_check.rb', line 5

def initialize(name, options = {}, &block)
  super(name, options, &block)
  
  unknown_keys = options.keys - [
    :deviates_high, :deviates_low, :scale_factor, :smoothing, :unless_below, :unless_above
  ].flatten
  raise(ArgumentError, "Unknown key(s): #{unknown_keys.join(", ")}") unless unknown_keys.empty?
        
  @options = options
  @scale_factor = options.fetch(:scale_factor, 2)
  @smoothing = options.fetch(:smoothing, true)
end

Instance Method Details

#scale_factorObject



18
19
20
# File 'lib/updawg/checks/deviation_check.rb', line 18

def scale_factor
  @scale_factor
end

#smoothingObject



22
23
24
# File 'lib/updawg/checks/deviation_check.rb', line 22

def smoothing
  @smoothing
end