Class: OpenHAB::DSL::Items::TimedCommand::TimedCommandDetails
- Inherits:
-
Struct
- Object
- Struct
- OpenHAB::DSL::Items::TimedCommand::TimedCommandDetails
- Defined in:
- lib/openhab/dsl/items/timed_command.rb
Overview
Provides information about why the expiration block of a timed command is being called.
Instance Method Summary collapse
- #cancelled? ⇒ true, false
- #expired? ⇒ true, false
-
#reschedule(time = nil) ⇒ void
Reschedule the timed command.
-
#resume ⇒ void
Resume a cancelled timed command to its original expiration time.
Instance Method Details
#cancelled? ⇒ true, false
64 65 66 |
# File 'lib/openhab/dsl/items/timed_command.rb', line 64 def cancelled? resolution == :cancelled end |
#expired? ⇒ true, false
59 60 61 |
# File 'lib/openhab/dsl/items/timed_command.rb', line 59 def expired? resolution == :expired end |
#reschedule(time = nil) ⇒ void
This method returns an undefined value.
Reschedule the timed command.
If the timed command was cancelled, this will also resume it.
77 78 79 80 |
# File 'lib/openhab/dsl/items/timed_command.rb', line 77 def reschedule(time = nil) self.resolution = nil timer.reschedule(time) end |
#resume ⇒ void
This method returns an undefined value.
Resume a cancelled timed command to its original expiration time.
87 88 89 90 91 92 93 |
# File 'lib/openhab/dsl/items/timed_command.rb', line 87 def resume if expired? logger.warn "Cannot resume a timed command that has expired. Use reschedule instead." else self.resolution = nil end end |