Closed jirutka closed 10 years ago
Nice!
For reference, I tend to write method calls in a Clojure-style where reasonable. This makes them more consistent with places where brackets are not needed. In this particular case:
(@document.attr 'sectnumlevels', 3).to_i
instead of
@document.attr('sectnumlevels', 3).to_i
I'll update after the merge.
(Admittedly, I haven't been perfectly consistent about the style, but I'd like to try to get there).
To be honest, I’ve noticed that, but I consider it a bad practice – it’s not idiomatic for Ruby (Ruby is not a Lisp dialect!) and it’s against de-facto standard Ruby style guide.
and it’s against de-facto standard Ruby style guide.
What can I say, I'm a rebel :)
My thinking isn't mainstream, but I view it as more idiomatic than the style guide recommendation. The reason is that Ruby allows brackets to be left out. When they have to be put back in, you can see it two ways. You can either see it as the brackets identify the boundaries of the expression or the brackets have to be used in the more traditional way around method arguments. I like how the brackets show the boundaries of the expression. I may lose this debate in the end, but to me it reads a lot better this way.
It’s just copied it from HAML template for now, I’ll rewrite it using helper method after merging asciidoctor#1143.