Sha256: 86b2a7481e4856de950483676d1b74b6b52777443b9beaf1dd616f9ebe851817
Contents?: true
Size: 727 Bytes
Versions: 3
Compression:
Stored size: 727 Bytes
Contents
module God module Conditions class Tries < PollCondition attr_accessor :times, :within def prepare @timeline = Timeline.new(self.times) end def valid? valid = true valid &= complain("You must specify the 'times' attribute for :tries") if self.times.nil? valid end def test @timeline << Time.now concensus = (@timeline.size == self.times) duration = within.nil? || (@timeline.last - @timeline.first) < self.within if concensus && duration @timeline.clear if within.nil? return true else return false end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
god-0.4.0 | lib/god/conditions/tries.rb |
god-0.4.1 | lib/god/conditions/tries.rb |
god-0.4.3 | lib/god/conditions/tries.rb |