Class: Arcp::FakeClock
- Inherits:
-
Object
- Object
- Arcp::FakeClock
- Defined in:
- lib/arcp/clock.rb
Instance Attribute Summary collapse
-
#monotonic_value ⇒ Object
Returns the value of attribute monotonic_value.
-
#now_value ⇒ Object
Returns the value of attribute now_value.
Instance Method Summary collapse
- #advance(seconds) ⇒ Object
-
#initialize(now: Time.utc(2026, 1, 1)) ⇒ FakeClock
constructor
A new instance of FakeClock.
- #monotonic ⇒ Object
- #now ⇒ Object
Constructor Details
#initialize(now: Time.utc(2026, 1, 1)) ⇒ FakeClock
Returns a new instance of FakeClock.
21 22 23 24 |
# File 'lib/arcp/clock.rb', line 21 def initialize(now: Time.utc(2026, 1, 1)) @now_value = now.utc @monotonic_value = 0.0 end |
Instance Attribute Details
#monotonic_value ⇒ Object
Returns the value of attribute monotonic_value.
19 20 21 |
# File 'lib/arcp/clock.rb', line 19 def monotonic_value @monotonic_value end |
#now_value ⇒ Object
Returns the value of attribute now_value.
19 20 21 |
# File 'lib/arcp/clock.rb', line 19 def now_value @now_value end |
Instance Method Details
#advance(seconds) ⇒ Object
29 30 31 32 33 |
# File 'lib/arcp/clock.rb', line 29 def advance(seconds) @now_value += seconds @monotonic_value += seconds self end |
#monotonic ⇒ Object
27 |
# File 'lib/arcp/clock.rb', line 27 def monotonic = @monotonic_value |
#now ⇒ Object
26 |
# File 'lib/arcp/clock.rb', line 26 def now = @now_value |