I'm somewhat new to writing my own rake tasks.  I have a pair of tasks
that convert some stuff from one format to another.

  rake my_ns:to_a
  rake my_ns:to_b

And everything works just fine.  The problem is that the implementation
the code is basically duplicated.  The process is the same, the only
real difference is that old_format and new_format local variables are
swapped in the second conversion task.  I want to make this much DRYer
by refactoring the common code out.

Now, if this was a ruby class, I would simply create a private method
called convert_to(format), or something similar.  Then the format
conversion happens in this method, based on the argument.

How does one accomplish this with rake tasks?  Basically I want to pass
arguments to a rake task, or method of some sort, and use the result.  A
simple task in general programming, but I am not sure how to make this
work in the context of rake.

Thanks for the help.
-- 
Posted via http://www.ruby-forum.com/.