In ruby script we can pass parameter like this in console:
`ruby r3.rb sam sou "samarth pandey"`
this will receive in a array but now i want to send parameter like this
`ruby sam sou {:sam => abc, :sou => abc}`
So how can i do this i don’t want to make my hash as string like
`ruby sam sou "{:sam => abc, :sou => abc}"`
There is no way to pass the hash without quotes, because the shell would recognize
>as an output redirection and pipe the output of your script into a file calledabc}.EDITED:
With the Ruby 1.9 Hash syntax you could do something like this:
foo.rb:
In the shell:
I think this is not very elegant nor is the syntax valid Ruby since the quotes of the values are missing, but it would be a solution for your task.