Class: Timer::Interval
Instance Attribute Summary collapse
-
#old ⇒ Object
Returns the value of attribute old.
Attributes inherited from Abstruct
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(term, block) ⇒ Interval
constructor
A new instance of Interval.
Methods inherited from Abstruct
Constructor Details
#initialize(term, block) ⇒ Interval
Returns a new instance of Interval.
97 98 99 100 101 |
# File 'lib/skype/os/timer.rb', line 97 def initialize term, block @term = term @old = Time.now.to_i @block = block end |
Instance Attribute Details
#old ⇒ Object
Returns the value of attribute old.
103 104 105 |
# File 'lib/skype/os/timer.rb', line 103 def old @old end |
Class Method Details
.polling(now) ⇒ Object
86 87 88 89 90 91 92 93 |
# File 'lib/skype/os/timer.rb', line 86 def polling now @stack.each do |interval| if now >= interval.term + interval.old interval.old = now interval.block.call end end end |