Class: Musa::Clock::ExternalTickClock
- Inherits:
-
Clock
- Object
- Clock
- Musa::Clock::ExternalTickClock
show all
- Defined in:
- lib/musa-dsl/transport/external-tick-clock.rb
Instance Method Summary
collapse
Methods inherited from Clock
#on_change_position, #on_start, #on_stop, #running?
Constructor Details
Returns a new instance of ExternalTickClock.
6
7
8
9
10
11
12
|
# File 'lib/musa-dsl/transport/external-tick-clock.rb', line 6
def initialize(do_log: nil)
do_log ||= false
super()
@do_log = do_log
end
|
Instance Method Details
#run(&block) ⇒ Object
14
15
16
17
18
|
# File 'lib/musa-dsl/transport/external-tick-clock.rb', line 14
def run(&block)
@on_start.each(&:call)
@run = true
@block = block
end
|
#terminate ⇒ Object
26
27
28
29
|
# File 'lib/musa-dsl/transport/external-tick-clock.rb', line 26
def terminate
@on_stop.each(&:call)
@run = false
end
|
#tick ⇒ Object
20
21
22
23
24
|
# File 'lib/musa-dsl/transport/external-tick-clock.rb', line 20
def tick
if @run
@block.call if @block
end
end
|