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

P

Patrick Doyle

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
 
P

Patrick Doyle

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top