Pregunta

With the new Ruby 2.0 named arguments feature, I have this method:

def method(named_argument1: value1, named_argument2: value2, named_argument3: value3, named_argument4: value4, named_argument5: value5, named_argument6: value16)
  # ...
end

As you see, really really long line. What is the best way to style this ?

EDIT

The fact is that we shouldn't write lines more than 80 characters, so I am looking not for THE subjective answer, but for ANY subjective answer that can help me choose what is the (best) approach. As any other subjective answer, they are the best way for you to find an answer.

Hope this explains why I made this question guys, if this is not an appropriate question let me know please.

¿Fue útil?

Solución

def method(
  named_argument1: value1,
  named_argument2: value2,
  named_argument3: value3,
  named_argument4: value4,
  named_argument5: value5,
  named_argument6: value16
)
  # ...
end
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top