Class: Burner::Library::Sleep
Overview
Arbitrarily put thread to sleep for X number of seconds
Note: this does not use Payload#registers.
Instance Attribute Summary collapse
-
#seconds ⇒ Object
readonly
Returns the value of attribute seconds.
Attributes inherited from Job
Instance Method Summary collapse
-
#initialize(name: '', seconds: 0) ⇒ Sleep
constructor
A new instance of Sleep.
- #perform(output, _payload) ⇒ Object
Methods included from Util::Arrayable
Constructor Details
#initialize(name: '', seconds: 0) ⇒ Sleep
Returns a new instance of Sleep.
18 19 20 21 22 23 24 |
# File 'lib/burner/library/sleep.rb', line 18 def initialize(name: '', seconds: 0) super(name: name) @seconds = seconds.to_f freeze end |
Instance Attribute Details
#seconds ⇒ Object (readonly)
Returns the value of attribute seconds.
16 17 18 |
# File 'lib/burner/library/sleep.rb', line 16 def seconds @seconds end |
Instance Method Details
#perform(output, _payload) ⇒ Object
26 27 28 29 30 |
# File 'lib/burner/library/sleep.rb', line 26 def perform(output, _payload) output.detail("Going to sleep for #{seconds} second(s)") Kernel.sleep(seconds) end |