Class: TestBench::Controls::Clock::Elapsed

Inherits:
Object
  • Object
show all
Defined in:
lib/test_bench/controls/clock/elapsed.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#t0Object (readonly)

Returns the value of attribute t0.



23
24
25
# File 'lib/test_bench/controls/clock/elapsed.rb', line 23

def t0
  @t0
end

#t1Object (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

.exampleObject



5
6
7
# File 'lib/test_bench/controls/clock/elapsed.rb', line 5

def self.example
  new t0, t1
end

.secondsObject



9
10
11
# File 'lib/test_bench/controls/clock/elapsed.rb', line 9

def self.seconds
  61.11111
end

.t0Object



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

.t1Object



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

#enumeratorObject



35
36
37
# File 'lib/test_bench/controls/clock/elapsed.rb', line 35

def enumerator
  @enumerator ||= [t0, t1].lazy
end

#nowObject



31
32
33
# File 'lib/test_bench/controls/clock/elapsed.rb', line 31

def now
  enumerator.next
end