# Command line options hash

**URL:** <https://www.ruby-forum.com/t/command-line-options-hash/146173>\
**Category:** Ruby\
**Created:** [August 18, 2008, 6:25pm UTC](https://www.ruby-forum.com/t/command-line-options-hash/146173 "2008-08-18T18:25:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aidy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eada6e/32.png) [@aidy](https://www.ruby-forum.com/u/aidy)\
**Post date:** [August 18, 2008, 6:25pm UTC](https://www.ruby-forum.com/t/command-line-options-hash/146173/1 "2008-08-18T18:25:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![aidy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eada6e/32.png) [@aidy](https://www.ruby-forum.com/u/aidy)\
**Post date:** [August 18, 2008, 6:30pm UTC](https://www.ruby-forum.com/t/command-line-options-hash/146173/2 "2008-08-18T18:30:05Z")

</div>

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”)

---

<div class="post-metadata">

**Author:** ![aidy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eada6e/32.png) [@aidy](https://www.ruby-forum.com/u/aidy)\
**Post date:** [August 18, 2008, 6:32pm UTC](https://www.ruby-forum.com/t/command-line-options-hash/146173/3 "2008-08-18T18:32:56Z")

</div>

> 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
