0
Does anyone think readability is affected when a method is called without parentheses in Ruby
2 Respostas
+ 2
Yes, leave them in.
+ 1
Depends.
I don't use parentheses usually. Ruby is beautiful enough and doesn't hamper the readability in most cases.
Example,
def sum a,b
a+b
end
sum 1,2 # allowed, doesn't seem as a hassle.
But, there are some cases you definitely should use parentheses.
eg, if the method takes quite a number of arguments,
or if you're printing the return value
puts sum 1,2 # discouraged
You should read the ruby style guide, as it's designed for maximum efficiency.
https://github.com/bbatsov/ruby-style-guide