All,
After going back over the win32-taskscheduler API, I''m leaning towards
making a significant API change. I''d like to change the constructor.
At the moment it looks like this:
server = TaskScheduler.new(name = nil, trigger = nil)
Which is a shortcut for:
server = TaskScheduler.new
server.new_work_item(name, trigger)
My philosophy at the time was that you typically create one task at a
time in practice, so this was convenient. However, when I look at that
code now it makes me think that the +server+ is tied to that particular
task, which it isn''t. The second form is clearer.
On top of that, we don''t have a way to set the root folder at the
moment. Combined with my reasons above, I''d like to change the
constructor to this:
server = TaskScheduler.new(folder = "\\", force = false)
Internally that would look something like this:
unless service.FolderExists(folder)
if force
service.CreateFolder(folder)
else
raise ArgumentError, "folder ''#{folder}'' does not
exist"
end
end
root = service.GetFolder(folder)
I could put in type checks to make sure people coming from 0.2.0 don''t
do something crazy by mistake, along with some warnings.
The alternative is to just leave the constructor alone and add
TaskScheduler#folder and TaskScheduler#folder= methods that would
require a separate method call, and reset our @root instance variable.
The downside, besides feeling clunky, is that it means the end user
would be making an unnecessary connection in the constructor, and would
have remember to make that call before making any other calls.
What say you?
Regards,
Dan