How do you tell a Ruby program to wait an arbitrary amount of time before moving on to the next line of code?
Ruby – Tell Ruby Program to Wait some amount of time
rubysleep
Related Topic
- Ruby – Convert to/from DateTime and Time in Ruby
- Ruby-on-rails – How to wrap link_to around some html ruby code
- Ruby: Calling class method from instance
- Excel – Execute external program in ruby and wait for its execution
- Ruby-on-rails – Measure and Benchmark Time for Ruby Methods
- Javascript – Execute a command line binary with Node.js
- PHP: Instantiate class by reference
Best Answer
Like this:
The
num_secs
value can be an integer or float.Also, if you're writing this within a Rails app, or have included the ActiveSupport library in your project, you can construct longer intervals using the following convenience syntax: