Class: Eye::Trigger::Flapping
- Inherits:
-
Eye::Trigger
- Object
- Eye::Trigger
- Eye::Trigger::Flapping
- Defined in:
- lib/eye/trigger/flapping.rb
Constant Summary
Constants inherited from Eye::Trigger
Instance Attribute Summary
Attributes inherited from Eye::Trigger
Attributes included from Dsl::Validation
#defaults, #should_bes, #validates, #variants
Attributes included from Logger::Helpers
Instance Method Summary collapse
- #good? ⇒ Boolean
-
#initialize(*args) ⇒ Flapping
constructor
A new instance of Flapping.
Methods inherited from Eye::Trigger
#check, create, get_class, validate!
Methods included from Dsl::Validation
Constructor Details
#initialize(*args) ⇒ Flapping
Returns a new instance of Flapping.
11 12 13 14 |
# File 'lib/eye/trigger/flapping.rb', line 11 def initialize(*args) super @last_at = nil end |
Instance Method Details
#good? ⇒ Boolean
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/eye/trigger/flapping.rb', line 16 def good? states = @states_history.states_for_period( within, @last_at ) down_count = states.count{|st| st == :down } if down_count >= times @last_at = @states_history.last_state_changed_at false else true end end |