Project

atdo

0.0
No commit activity in last 3 years
No release in over 3 years
At time, do code.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

atdo

At time, do code. That is all.

Oh, ok, if you insist, here's a little example:

require 'atdo'

scheduler = AtDo.new
scheduler.at Time.now + 2 do
  puts "hello"
end
scheduler.at Time.now + 2 do
  puts "world"
end
sleep 3

And with rbtree storage instead of array:

require 'atdo'
require 'rbtree'

scheduler = AtDo.new storage: MultiRBTree
scheduler.at Time.now + 2 do
  puts "hello"
end
scheduler.at Time.now + 2 do
  puts "world"
end
sleep 3

Both of these output

hello
world

See the unit tests for more examples.

The rbtree option is better for larger lists of tasks, especially with random inserts.