Rake: undefined method `to_sym' for [:first_name, :last_name]:Array

When I run the example given in the rake documentation under "Tasks
that expect parameters", namely:

task :name, [:first_name, :last_name] do |t, args|
  args.with_defaults(:first_name => "John", :last_name => "Dough")
  puts "First name is #{args.first_name}"
  puts "Last name is #{args.last_name}"
end

I get the following error:

$ rake -f foo.rb
(in C:/home/wpd/ruby/gdsii)
rake aborted!
undefined method `to_sym' for [:first_name, :last_name]:Array
C:/home/wpd/ruby/gdsii/foo.rb:1
(See full trace by running task with --trace)

Any clues where to start to track this down? I am running rake
version 0.8.1 on top of Ruby 1.8.6 (on an XP platform, if that
matters).

Also, as long as I'm in the neighborhood, the documentation on
rake.rubyforge.org states:

"Tasks that use parameters have a slightly different format for
prerequisites. Use the :needs keyword to specify the prerequisites for
tasks with arguments. For example: " ... but the example that follows
doesn't show the use of the ":needs" keyword".

(This hasn't been an issue for me yet, but I happened to notice that
as I read the docs and wondered about it at the time.)

--wpd

This appears to be a 0.8.1 problem -- at least, it went away when I I
did a "gem update rake" (and was updated to 0.8.3).

--wpd

···

On Tue, Sep 30, 2008 at 9:17 AM, Patrick Doyle <wpdster@gmail.com> wrote:

When I run the example given in the rake documentation under "Tasks
that expect parameters", namely:

task :name, [:first_name, :last_name] do |t, args|
args.with_defaults(:first_name => "John", :last_name => "Dough")
puts "First name is #{args.first_name}"
puts "Last name is #{args.last_name}"
end

I get the following error:

$ rake -f foo.rb
(in C:/home/wpd/ruby/gdsii)
rake aborted!
undefined method `to_sym' for [:first_name, :last_name]:Array
C:/home/wpd/ruby/gdsii/foo.rb:1
(See full trace by running task with --trace)

Any clues where to start to track this down? I am running rake
version 0.8.1 on top of Ruby 1.8.6 (on an XP platform, if that
matters).

Also, as long as I'm in the neighborhood, the documentation on
rake.rubyforge.org states:

"Tasks that use parameters have a slightly different format for
prerequisites. Use the :needs keyword to specify the prerequisites for
tasks with arguments. For example: " ... but the example that follows
doesn't show the use of the ":needs" keyword".

(This hasn't been an issue for me yet, but I happened to notice that
as I read the docs and wondered about it at the time.)

--wpd