Class: OpenHAB::DSL::Timer

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/openhab/dsl/timers/timer.rb

Instance Method Summary collapse

Constructor Details

#initialize(duration:, thread_locals: {}, &block) ⇒ Timer

Create a new Timer Object



12
13
14
15
16
# File 'lib/rspec/openhab/dsl/timers/timer.rb', line 12

def initialize(duration:, thread_locals: {}, &block) # rubocop:disable Lint/UnusedMethodArgument
  @duration = duration

  Timers.timer_manager.add(self)
end

Instance Method Details

#cancelBoolean

Cancel timer



27
28
29
# File 'lib/rspec/openhab/dsl/timers/timer.rb', line 27

def cancel
  Timers.timer_manager.delete(self)
end

#is_activeObject

rubocop:disable Naming/PredicateName



34
35
36
# File 'lib/rspec/openhab/dsl/timers/timer.rb', line 34

def is_active # rubocop:disable Naming/PredicateName
  false
end

#reschedule(_duration = nil) ⇒ Object



18
19
20
# File 'lib/rspec/openhab/dsl/timers/timer.rb', line 18

def reschedule(_duration = nil)
  Timers.timer_manager.add(self)
end

#terminated?Boolean Also known as: has_terminated



31
# File 'lib/rspec/openhab/dsl/timers/timer.rb', line 31

def terminated?; end