15

I just installed Ruby 1.9.2 after having used 1.8.7, as there is a feature I need. I had called many of my methods like this:

do_something (arg0, arg1) 

With 1.9.2, i get the following error, syntax error, unexpected ',', expecting ')' and the fix seems to be:

do_something arg0, arg1 

But this could take me hours to fix all the cases. Is there a way around this? Why is it an error in the first place? thanks

2
  • 4
    Or not using a space before the parens, long-recommended to avoid. Commented Dec 17, 2011 at 0:36
  • 8
    To be fair: Your code does produce warnings that you shouldn't put spaces before open parentheses using ruby 1.8.7. So it's not like this problem suddenly appeared out of nowhere without warning. Commented Dec 17, 2011 at 0:41

1 Answer 1

43

The extra space is the culprit. Use:

do_something(arg0, arg1) 
Sign up to request clarification or add additional context in comments.

4 Comments

Same problem here, now installing 1.8.7 to see if it works. My "syntax error" is: /home/kinduff/www/creamcheese/app/admin/grupos.rb:9: syntax error, unexpected ':', expecting '}' a { href: admin_recipe_path(receta.id) }, do
Use explicit () and don't use a comma before the block, like so: a({href: admin_recipe_path(receta.id)}) do. The way you do it ruby thinks the {} denote a block when in fact it's a hash.
But is a large project, and the weird thing is that some days behind it worked like a charm, but now I can't.
I dont understand this? when ruby is space insensitive then why is do_something(arg0, arg1) different from do_something (arg0, arg1)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.