Class: TestBench::Controls::Clock::Elapsed
- Inherits:
-
Object
- Object
- TestBench::Controls::Clock::Elapsed
- Defined in:
- lib/test_bench/controls/clock/elapsed.rb
Instance Attribute Summary collapse
-
#t0 ⇒ Object
readonly
Returns the value of attribute t0.
-
#t1 ⇒ Object
readonly
Returns the value of attribute t1.
Class Method Summary collapse
Instance Method Summary collapse
- #enumerator ⇒ Object
-
#initialize(t0, t1) ⇒ Elapsed
constructor
A new instance of Elapsed.
- #now ⇒ Object
Constructor Details
#initialize(t0, t1) ⇒ Elapsed
Returns a new instance of Elapsed.
26 27 28 29 |
# File 'lib/test_bench/controls/clock/elapsed.rb', line 26 def initialize t0, t1 @t0 = t0 @t1 = t1 end |
Instance Attribute Details
#t0 ⇒ Object (readonly)
Returns the value of attribute t0.
23 24 25 |
# File 'lib/test_bench/controls/clock/elapsed.rb', line 23 def t0 @t0 end |
#t1 ⇒ Object (readonly)
Returns the value of attribute t1.
24 25 26 |
# File 'lib/test_bench/controls/clock/elapsed.rb', line 24 def t1 @t1 end |
Class Method Details
.example ⇒ Object
5 6 7 |
# File 'lib/test_bench/controls/clock/elapsed.rb', line 5 def self.example new t0, t1 end |
.seconds ⇒ Object
9 10 11 |
# File 'lib/test_bench/controls/clock/elapsed.rb', line 9 def self.seconds 61.11111 end |
.t0 ⇒ Object
13 14 15 16 |
# File 'lib/test_bench/controls/clock/elapsed.rb', line 13 def self.t0 time = Time.new 2000, 1, 1, 1, 1, 1.11111, 0 time.round 5 end |
.t1 ⇒ Object
18 19 20 21 |
# File 'lib/test_bench/controls/clock/elapsed.rb', line 18 def self.t1 time = Time.new 2000, 1, 1, 1, 2, 2.22222, 0 time.round 5 end |
Instance Method Details
#enumerator ⇒ Object
35 36 37 |
# File 'lib/test_bench/controls/clock/elapsed.rb', line 35 def enumerator @enumerator ||= [t0, t1].lazy end |
#now ⇒ Object
31 32 33 |
# File 'lib/test_bench/controls/clock/elapsed.rb', line 31 def now enumerator.next end |