Timers and intervalls
-
Add the dependency to your
shard.yml
:dependencies: time_utils: github: data-niklas/time_utils
-
Run
shards install
require "time_utils"
Timer.run(5.seconds) do |timer|
puts "5 seconds"
end
timer2 = Timer.new(3.seconds) do |timer|
puts Time.utc - timer.at
end
timer2.run
Javascript like methods are exposed
setTimeout(1000) do |timer|
puts "1 second"
end
Recurring events:
Timer.run(5.seconds,true) do |timer|
puts "Every 5 seconds"
end
TODO: Write usage instructions here
TODO: Write development instructions here
- Fork it (https://github.com/data-niklas/time_utils/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
- Niklas Loeser - creator and maintainer