[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

command line options hash

aidy

8/18/2008 4:23:00 PM

Hi,

I have an options hash map as a run method's second parameter

I am currently doing this

run File.join(File.dirname(__FILE__), "../projects/#{filename}", {"-
fh:" => "C:/rspec_reports/#{filename}.htm"})

But I am recieving this error

`join': can't convert Hash into String (TypeError)

Could anyone give me the correct syntax please?

Aidy
2 Answers

WujcioL

8/18/2008 4:27:00 PM

0

aidy wrote:
> Hi,
>
> I have an options hash map as a run method's second parameter
>
> I am currently doing this
>
> run File.join(File.dirname(__FILE__), "../projects/#{filename}", {"-
> fh:" => "C:/rspec_reports/#{filename}.htm"})
>
> But I am recieving this error
>
> `join': can't convert Hash into String (TypeError)
>
> Could anyone give me the correct syntax please?
>
> Aidy

Try this:
run File.join(File.dirname(__FILE__), "../projects/#{filename}", "-
fh: => C:/rspec_reports/#{filename}.htm")
--
Posted via http://www.ruby-....

Pit Capitain

8/18/2008 4:29:00 PM

0

> I have an options hash map as a run method's second parameter
>
> run File.join(File.dirname(__FILE__), "../projects/#{filename}", {"-
> fh:" => "C:/rspec_reports/#{filename}.htm"})

Aidy, you call the run method with only one parameter, the result of
File.join. The hash is the third parameter to File.join.

Regards,
Pit