Class: Dynflow::Testing::ManagedClock
- Inherits:
-
Object
- Object
- Dynflow::Testing::ManagedClock
- Includes:
- Algebrick::Types
- Defined in:
- lib/dynflow/testing/managed_clock.rb
Defined Under Namespace
Modules: Timer
Instance Attribute Summary collapse
-
#pending_pings ⇒ Object
readonly
Returns the value of attribute pending_pings.
Instance Method Summary collapse
- #clear ⇒ Object
-
#initialize ⇒ ManagedClock
constructor
A new instance of ManagedClock.
- #ping(who, time, with_what = nil, where = :<<) ⇒ Object
- #progress ⇒ Object
Constructor Details
#initialize ⇒ ManagedClock
Returns a new instance of ManagedClock.
19 20 21 |
# File 'lib/dynflow/testing/managed_clock.rb', line 19 def initialize @pending_pings = [] end |
Instance Attribute Details
#pending_pings ⇒ Object (readonly)
Returns the value of attribute pending_pings.
5 6 7 |
# File 'lib/dynflow/testing/managed_clock.rb', line 5 def pending_pings @pending_pings end |
Instance Method Details
#clear ⇒ Object
34 35 36 |
# File 'lib/dynflow/testing/managed_clock.rb', line 34 def clear @pending_pings.clear end |
#ping(who, time, with_what = nil, where = :<<) ⇒ Object
23 24 25 26 |
# File 'lib/dynflow/testing/managed_clock.rb', line 23 def ping(who, time, with_what = nil, where = :<<) with = with_what.nil? ? None : Some[Object][with_what] @pending_pings << Timer[who, time, with, where] end |
#progress ⇒ Object
28 29 30 31 32 |
# File 'lib/dynflow/testing/managed_clock.rb', line 28 def progress copy = @pending_pings.dup clear copy.each { |ping| ping.apply } end |