guard / guard-nanoc

A Guard for nanoc
39 stars 9 forks source link

Simplified if-else construct #6

Closed matthiasbeyer closed 11 years ago

matthiasbeyer commented 11 years ago

I simplified the nested if-else construct near lib/guard/nanoc.rb#46.

denisdefreyne commented 11 years ago

I’m not in favour of pulling this change because I think it doesn’t improve the readability in a significant way. Two remarks that I’d like to give:

  1. The then after an if is entirely optional and is rarely used in Ruby, so I’d drop that.
  2. !, && and || are preferred over not, and and or, respectively. The latter have lower operator precedence, which trips up a lot of people.
  3. Nested ifs should be flattened and should use elsifs.

Even with these changes, I don’t think it’s much better than the original, so I’d like to keep it that way.